Dining_Hall/pages/post/index.vue

52 lines
1.2 KiB
Vue
Raw Normal View History

<template>
<view>
<web-view :update-title="false" :webview-styles="webviewStyles" :src="webViewSrc"></web-view>
</view>
</template>
<script>
let wv // 计划创建的webview
export default {
data() {
return {
webViewHeight: 0,
webviewStyles: {
top: "30px"
},
phoneNumber: '15996330508'
};
},
computed: {
webViewSrc() {
return `https://static-mp-0ff94970-f63b-4d95-afbe-cab23f55e253.next.bspapp.com/web/index.html#/?mobile=${this.phoneNumber}`;
}
},
onReady() {
// 获取屏幕高度
/* uni.getSystemInfo({
success: (res) => {
this.webViewHeight = res.screenHeight - 50; // 假设导航栏高度为50px
console.log('屏幕高度:', this.webViewHeight)
},
fail: (err) => {
console.error('获取系统信息失败:', err);
}
});*/
// #ifdef APP-PLUS
const currentWebview = this.$scope.$getAppWebview() // 获取当前页面的webview对象
setTimeout(function() {
wv = currentWebview.children()[0]
wv.setStyle({
scalable: true
})
}, 1000); // 如果是页面初始化调用时,需要延时一下
// #endif
}
};
</script>
<style lang="scss" scoped>
page {
background: #fff;
}
</style>