pdf.vue 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. <template>
  2. <view class="pdf-view"> <view id="demo"></view> </view>
  3. </template>
  4. <script>
  5. // import Pdfh5 from 'pdfh5'
  6. import 'pdfh5/css/pdfh5.css'
  7. export default {
  8. data() {
  9. return {
  10. pdfh5: null,
  11. pdfurl: '',
  12. title: ''
  13. }
  14. },
  15. onLoad(option) {
  16. console.log(option)
  17. this.pdfurl = option.url
  18. this.title = option.title || ''
  19. uni.setNavigationBarTitle({
  20. title: this.title
  21. })
  22. },
  23. onReady() {
  24. //实例化
  25. // console.log(Pdfh5)
  26. // this.pdfh5 = new Pdfh5('#demo', {
  27. // pdfurl: this.pdfurl,
  28. // lazy: true
  29. // })
  30. // //监听完成事件
  31. // this.pdfh5.on('complete', function(status, msg, time) {
  32. // console.log('状态:' + status + ',信息:' + msg + ',耗时:' + time + '毫秒,总页数:' + this.totalNum)
  33. // })
  34. }
  35. }
  36. </script>
  37. <style lang="scss">
  38. .pdf-view {
  39. width: 100%;
  40. height: 100vh;
  41. }
  42. </style>