0.1.7 • Published 3 months ago

pdf-previewer v0.1.7

Weekly downloads
-
License
MIT
Repository
-
Last release
3 months ago

typora-root-url: public

pdf-previewer

效果图

npm.io

Project setup

npm install pdf-previewer

使用方法

全局注册

import PdfPreviewer from 'pdf-previewer'
import 'pdf-previewer/dist/pdf-previewer.css'
Vue.use(PdfPreviewer)

局部注册

<script>
  import PdfPreviewer from 'pdf-previewer'
  import 'pdf-previewer/dist/pdf-previewer.css'
  export default {
      name:'xxx',
      components:{PdfPreviewer}
  }
</script>

在项目中使用

<template>
 <div>
     <button @click="openPdf">预览</button>
     <pdf-previewer ref="pdfRef" :file="fileObj" />
 </div>
</template>
<script>
  import PdfPreviewer from 'pdf-previewer'
  import 'pdf-previewer/dist/pdf-previewer.css'
  export default {
      name:'xxx',
      components:{PdfPreviewer},
      data(){
          return {
              fileObj:{
                  fileName:'xxxx',filePath:'xxxxx'
              }
          }
      }
      methods:{
          openPdf(){
              this.$nextTick(()=>{
                  this.$refs.pdfRef.openPDF()
              })
              
          }
      }
  }
</script>

配置项

属性类型默认值
fileObject{ fileName:'turnjs4-api-docs.pdf', filePath:'/turnjs4-api-docs.pdf'}
0.1.7

3 months ago

0.1.2

3 months ago

0.1.4

3 months ago

0.1.3

3 months ago

0.1.6

3 months ago

0.1.5

3 months ago

0.1.1

3 months ago

0.1.0

3 months ago