html目录结构
![在这里插入图片描述](https://img-blog.csdnimg.cn/30a0fc034ed048da8c472a809141af2a.jpeg#pic_center)
添加组件
<template>
<view class="webview_mask" v-if="showWeb">
<view class="webview_box">
<!-- #ifdef APP-PLUS -->
<!-- 直接链接地址传参-->
<web-view :src="'/hybrid/html/uploadFile.html?funcId='+baseUrl+'&token='+token"
@message="postMessage"
:update-title="false"
:fullscreen="false"
:webview-styles="webviewStyles"
class="web_view"
ref="webView"></web-view>
<!-- #endif -->
</view>
</view>
</template>
<script>
import indexConfig from '@/config/index.config';
let wv = null
export default{
name:"uploadFile",
data(){
return {
webviewStyles:{
width:'280px',
height: '170px'
},
funcId:"",
showWeb:false
}
},
onLoad() {
},
mounted() {
},
computed:{
baseUrl(){
return this.$getBaseUrl()+'/prod-api';
},
token(){
let access_token = this.$getStorage("accessToken");
return access_token;
}
},
methods:{
open(){
this.showWeb = true;
const currentWebview = this.$parent.$scope.$getAppWebview();
uni.getSystemInfo({
success: function (res){
let width = res.windowWidth;
let height = res.screenHeight;
let top_value = (height - 170)/2;
let left_value = (width - 280)/2;
setTimeout(() => {
wv = currentWebview.children()[0];
wv.setStyle(
{
position: 'absolute',
top:top_value,