37 lines
745 B
Vue
37 lines
745 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) {
|
|
this.url = options.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> |