index.vue 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. <template>
  2. <view style="position: absolute;
  3. top: 0;
  4. left: 0;
  5. right: 0;
  6. height: 100%;">
  7. <web-view :src="url"></web-view>
  8. <!-- <iframe width="100%" height="800rpx" :src="url"></iframe> -->
  9. </view>
  10. </template>
  11. <script setup>
  12. import {
  13. onMounted,
  14. computed,
  15. ref
  16. } from 'vue';
  17. import {
  18. onLoad,
  19. } from '@dcloudio/uni-app';
  20. import {
  21. store
  22. } from '../../store';
  23. const urlList = JSON.parse(uni.getStorageSync('baseUrl'))
  24. const url = ref("")
  25. const pdfUrl = ref("")
  26. const webHost = ref(urlList.pdfAppURL)
  27. const fileUrl = ref("")
  28. const pdfjs = ref("/static/hybrid/html/web/viewer.html")
  29. const totalPage = ref(0) //总页码
  30. const currentReadPage = ref(0) //当前页码
  31. onLoad((options) => {
  32. console.log(urlList)
  33. pdfUrl.value = options.param1
  34. fileUrl.value = webHost.value + pdfUrl.value
  35. console.log(webHost.value)
  36. uni.setNavigationBarTitle({
  37. title: ""
  38. });
  39. console.log(fileUrl.value)
  40. init();
  41. });
  42. function init() {
  43. console.log(fileUrl.value)
  44. url.value = pdfjs.value + '?file=' + encodeURIComponent(fileUrl.value);
  45. console.log(11, url.value)
  46. }
  47. </script>
  48. <style>
  49. </style>