Browse Source

bug修改

祁鹏飞 6 days ago
parent
commit
1cf08e60c3
1 changed files with 23 additions and 0 deletions
  1. 23 0
      pages/lottery/index.vue

+ 23 - 0
pages/lottery/index.vue

@@ -38,6 +38,29 @@ export default {
 
 		this.to_url = 'https://life.baoxianzhanggui.com/custh5/#/packageF/pages/activity/lottery/turntable?activityId=' + activityId + '&localActivityTableId=' + localActivityTableId + '&currentPlatform=' + currentPlatform + '&currentUser=' + currentUser + '&tenantId=' + tenantId;
 	},
+	onShow(){
+// #ifdef APP-PLUS
+                        // 设置webview显示时顶部丢失问题
+                        var height = 0; //定义动态的高度变量,如高度为定值,可以直接写
+                        uni.getSystemInfo({
+                                //成功获取的回调函数,返回值为系统信息
+                                success: (sysinfo) => {
+                                        height = sysinfo.windowHeight -
+                                                40; //自行修改,自己需要的高度 此处如底部有其他内容,可以直接---(-50)这种,如果不减,页面会下沉,看不到底部导航栏
+                                },
+                                complete: () => {}
+                        });
+                        var currentWebview = this.$scope.$getAppWebview(); //获取当前web-view
+                        setTimeout(function() {
+                                var wv = currentWebview.children()[0];
+                                wv.setStyle({ //设置web-view距离顶部的距离以及自己的高度,单位为px
+                                        top: 40, //此处是距离顶部的高度,应该是你页面的头部
+                                        height: height, //webview的高度
+                                        scalable: false, //webview的页面是否可以缩放,双指放大缩小,
+                                })
+                        }, 500); //如页面初始化调用需要写延迟
+                        // #endif
+	},
 	methods: {
 		// 这个 getMessage 在 H5 下其实不会被调到,可以保留给 App/小程序用
 		getMessage(event) {