Files
Hfive/pages/webview/webview.vue
2024-05-08 19:37:19 +08:00

38 lines
860 B
Vue

<template>
<web-view :src="url"></web-view>
</template>
<script>
export default {
data() {
return {
url: '', //PDF路径
};
},
onLoad(options) {
console.log(options)
if (options.tape == 1) {
this.url = options.url;
} else {
uni.request({
url: uni.conf.baseUrl + 'szzpy/downloadurl',
data: {
//参数
id: options.id
},
method: 'POST', //请求方式,必须为大写
success: res => {
let fileUrl = options.url
this.url = 'https://www.pfile.com.cn/api/profile/onlinePreview?url=' +
encodeURIComponent(res.data.data);
// this.url = 'https://view.officeapps.live.com/op/view.aspx?src=' + res.data.data
// console.log(this.url)
// window.open('https://view.officeapps.live.com/op/view.aspx?src=' + res.data.data)
}
});
}
}
};
</script>