Retired/pages/news/document.vue

52 lines
1.0 KiB
Vue

<template>
<view class="">
<!-- <web-view :src="allUrl"></web-view> -->
</view>
</template>
<script>
export default {
data() {
return {
allUrl: "",
}
},
onLoad() {
// this.allUrl = '/hybrid/html/web/viewer.html?file='+encodeURIComponent('https://resource.leapy.cn/retired/职业技能培训.pdf')
this.getDocment()
},
methods: {
getDocment() {
var that = this
uni.showLoading({
title: '正在加载中..'
})
uni.downloadFile({
url: 'https://resource.leapy.cn/retired/职业技能培训.pdf',
success: function(res) {
uni.openDocument({
filePath: res.tempFilePath,
fileType: 'pdf',
success: function(res) {
console.log(res)
uni.hideLoading()
console.log('打开文档成功');
},
fail: function(err) {
uni.hideLoading()
console.log('fail:' + JSON.stringify(err));
}
});
},
complete: function(r) {
console.log(r, 'r');
uni.hideLoading()
}
});
}
}
}
</script>
<style>
</style>