Files
Hfive/pages/webview/webview.vue
2024-11-13 09:25:34 +08:00

40 lines
838 B
Vue

<template>
<web-view :src="url"></web-view>
</template>
<script>
export default {
data() {
return {
url: '', //PDF路径
};
},
async onLoad(options) {
console.log(options)
if (options.tape == 1) {
let res = await this.api.szzpyhurl({
store_id: uni.getStorageSync('userId')
})
this.url = res.data.url;
} else {
let res = await this.api.szzpydownloadurl({
id: options.id
})
if (res) {
let fileUrl = options.url
var user = navigator.userAgent;
//android端
var isAndroid = user.indexOf("Android") > -1 || user.indexOf("Adr") > -1;
//ios端
var isiOS = !!user.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/);
if (isAndroid) {
window.open(res.data)
} else if (isiOS) {
window.location.href = res.data;
}
}
}
}
};
</script>