12345678910111213141516171819202122232425262728293031323334353637 |
- <template>
- <web-view :src="webSrc"/>
- </template>
- <script setup>
- import {ref, onMounted, getCurrentInstance} from "vue";
- import {onLoad} from '@dcloudio/uni-app'
- //初始变量
- let wv;
- const instance = getCurrentInstance().proxy
- const webSrc = ref('');
- onLoad((option) => {
- if (option.url) {
- webSrc.value = '/hybrid/html/pdf/web/viewer.html?file= ' + decodeURIComponent(option.url);
- }
- })
- //渲染完成
- onMounted(() => {
- // #ifdef APP-PLUS
- let currentWebview = instance.$scope.$getAppWebview()
- //如果是页面初始化调用时,需要延时一下
- setTimeout(function() {
- wv = currentWebview.children()[0]
- wv.setStyle({scalable:true})
- }, 1000);
- // #endif
- })
- </script>
- <style lang="scss">
- page {
- height: auto;
- }
- </style>
|