ccyl-pdf-shower
v1.0.0
Published
长城医疗vue pdf预览组件
Downloads
4
Readme
ccyl-pdf-shower
介绍
基于pdf.js的pdf简易查看组件。 该组件加载全部pdf页面,不提供翻页查看功能。
install
npm i ccyl-pdf-shower --save
example
<template>
<div>
<pdfShower
:errorHint = "errorHint"
:pdfUrl = "pdfUrl"
></pdfShower>
</div>
</template>
<script>
import { getQuestionListPath } from '@/api/questionList'
import pdfShower from 'ccyl-pdf-shower'
export default {
name: 'questionList',
components: {
pdfShower
},
data() {
return {
errorHint: "FAQ问题集打开失败",
pdfUrl: null
};
},
mounted() {
this.setPdfUrl()
},
methods:{
setPdfUrl(){
getQuestionListPath({}).then(res => {
const baseUrl = process.env.VUE_APP_BASE_API.endsWith('/') ? process.env.VUE_APP_BASE_API : process.env.VUE_APP_BASE_API + '/'
this.pdfUrl = baseUrl + res.docPath
})
}
}
}
</script>