vue+iview+vue-pdf实现在线预览pdf

使用vue-pdf
安装:npm install vue-pdf --save -D
代码示例

previewPdf.vue

import pdf from 'vue-pdf'
export default {
    components:{pdf},
    data(){
        return{
            modalVisible:false,
            src:'',
            pageNum:1,
            pageTotalNum:1
        }
    },
    methods:{
        pageLoaded(e){
            this.curPageNum = e
        },
        prePage(){
            var p = this.pageNum
            p = p>1?p-1:this.pageTotalNum
            this.pageNum = p
        },
        nextPage(){
            var p = this.pageNum
            p = p

你可能感兴趣的:(vue+iview+vue-pdf实现在线预览pdf)