Files
douhuo-h5/pages/filePreview.vue
2023-05-15 13:18:38 +08:00

64 lines
1.2 KiB
Vue

<template>
<view>
<view class="pack-center pages-hint grey" v-if="loading">
<image src="/static/imgs/loadingGif.gif" ></image>
<view>疯狂加载中...</view>
</view>
<web-view :src="pdfUrl"></web-view>
<!-- <web-view src="https://uniapp.dcloud.io/static/web-view.html"></web-view> -->
<!-- <web-view src="/static/hybrid/web/viewer.html" :webview-styles="{height:'100%'}"></web-view> -->
</view>
</template>
<script>
export default {
data() {
return {
viewerUrl : '/static/hybrid/web/viewer.html',
pdfUrl : '',
loading : true
};
},
onLoad(params){
let that = this
setTimeout(function() {
that.loading = false
const urlStr = params.url; // 这里是获取的url值
that.pdfUrl = `${that.viewerUrl}?file=${decodeURIComponent(urlStr)}`;
}, 2000);
},
onBackPress(){}
}
</script>
<style>
.pack-center {
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-box-pack: center;
position: absolute;
left: 0;
right: 0;
top: 0;
bottom: 0;
z-index: -1;
}
.pages-hint {
width: 100%;
text-align: center;
color: #747788;
font-size: 28rpx;
background: white;
background-color: #f9f9f9;
}
.pages-hint image {
width: 220rpx;
height: 220rpx;
}
</style>