<template>
    <!-- pdf查看 -->
    <el-dialog
        :title="checkText"
        :visible.sync="visiable"
        custom-class="pdfPreview"
        :fullscreen="true"
        :before-close="handleClose"
        >
        <span>
            <iframe
            width="100%"
            height="100%"
            :src="src"
            ></iframe>
        </span>
    </el-dialog>
</template>
<script>
import { httpproxyMethod } from 'aegle-sp-components/src/utils/index'
export default {
    props: {
        // src: String
    },
    data() {
        return {
            visiable: false,
            iframeHeight: '800px',
            src: '',
            checkText: ''
        }
    },
    methods: {
        handleClose() {
            this.visiable = false
        },
        open(d){
            this.checkText = d.name || ''
            if(d.name) {
                let index = d.pdfFileUrl.lastIndexOf("/");
                this.checkText = d.src.substring(
                    index + 1,
                    d.src.length
                );
            }
            this.src = httpproxyMethod(d.src);
            this.visiable = true
        }
    }
}
</script>
<style lang="less">
.pdfPreview {
    .el-dialog__body {
        height: calc(100% - 35px);
        padding: 30px 0 0;
        overflow: hidden;
    }
}
</style>