From cec4e9f600efca3ab0582a92e6592302e9473308 Mon Sep 17 00:00:00 2001 From: weilanwl <1273753708@qq.com> Date: Tue, 17 Sep 2019 02:03:28 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dios=20=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=A0=8F=E9=94=99=E4=BD=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复ios 状态栏错位 --- Colorui-UniApp/App.vue | 14 ++++++++++---- Colorui-UniApp/pages/plugin/animation.vue | 2 +- demo/app.js | 10 +++++++--- demo/app.json | 5 +++-- demo/pages/about/home/home.wxml | 2 +- demo/pages/plugin/animation/animation.wxml | 2 +- demo/project.config.json | 2 ++ demo/sitemap21.json | 7 +++++++ template/app.js | 10 +++++++--- 9 files changed, 39 insertions(+), 15 deletions(-) create mode 100644 demo/sitemap21.json diff --git a/Colorui-UniApp/App.vue b/Colorui-UniApp/App.vue index 763e269..469e182 100755 --- a/Colorui-UniApp/App.vue +++ b/Colorui-UniApp/App.vue @@ -13,12 +13,18 @@ }; // #endif - // #ifdef MP-WEIXIN + // #ifdef MP-WEIXIN || MP-QQ Vue.prototype.StatusBar = e.statusBarHeight; - let custom = wx.getMenuButtonBoundingClientRect(); - Vue.prototype.Custom = custom; - Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight; + let capsule = wx.getMenuButtonBoundingClientRect(); + if (capsule) { + Vue.prototype.Custom = capsule; + // Vue.prototype.capsuleSafe = uni.upx2px(750) - capsule.left + uni.upx2px(750) - capsule.right; + Vue.prototype.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight; + } else { + Vue.prototype.CustomBar = e.statusBarHeight + 50; + } // #endif + // #ifdef MP-ALIPAY Vue.prototype.StatusBar = e.statusBarHeight; diff --git a/Colorui-UniApp/pages/plugin/animation.vue b/Colorui-UniApp/pages/plugin/animation.vue index da59755..ad50feb 100755 --- a/Colorui-UniApp/pages/plugin/animation.vue +++ b/Colorui-UniApp/pages/plugin/animation.vue @@ -47,7 +47,7 @@ - + diff --git a/demo/app.js b/demo/app.js index 00d52a0..5e956d3 100644 --- a/demo/app.js +++ b/demo/app.js @@ -9,9 +9,13 @@ App({ wx.getSystemInfo({ success: e => { this.globalData.StatusBar = e.statusBarHeight; - let custom = wx.getMenuButtonBoundingClientRect(); - this.globalData.Custom = custom; - this.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight; + let capsule = wx.getMenuButtonBoundingClientRect(); + if (capsule) { + this.globalData.Custom = capsule; + this.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight; + } else { + this.globalData.CustomBar = e.statusBarHeight + 50; + } } }) }, diff --git a/demo/app.json b/demo/app.json index 3cc007a..7a79017 100644 --- a/demo/app.json +++ b/demo/app.json @@ -43,6 +43,7 @@ "navigationBarTextStyle": "white" }, "usingComponents": { - "cu-custom":"/colorui/components/cu-custom" - } + "cu-custom": "/colorui/components/cu-custom" + }, + "sitemapLocation": "sitemap21.json" } \ No newline at end of file diff --git a/demo/pages/about/home/home.wxml b/demo/pages/about/home/home.wxml index 2a3b6b9..386b86b 100644 --- a/demo/pages/about/home/home.wxml +++ b/demo/pages/about/home/home.wxml @@ -7,7 +7,7 @@ By:文晓港 - + diff --git a/demo/pages/plugin/animation/animation.wxml b/demo/pages/plugin/animation/animation.wxml index 9aa2f4f..057864c 100644 --- a/demo/pages/plugin/animation/animation.wxml +++ b/demo/pages/plugin/animation/animation.wxml @@ -42,7 +42,7 @@ - + diff --git a/demo/project.config.json b/demo/project.config.json index 25c41b2..1e8f298 100644 --- a/demo/project.config.json +++ b/demo/project.config.json @@ -18,6 +18,8 @@ "hidedInDevtools": [] }, "isGameTourist": false, + "simulatorType": "wechat", + "simulatorPluginLibVersion": {}, "condition": { "search": { "current": -1, diff --git a/demo/sitemap21.json b/demo/sitemap21.json new file mode 100644 index 0000000..ca02add --- /dev/null +++ b/demo/sitemap21.json @@ -0,0 +1,7 @@ +{ + "desc": "关于本文件的更多信息,请参考文档 https://developers.weixin.qq.com/miniprogram/dev/framework/sitemap.html", + "rules": [{ + "action": "allow", + "page": "*" + }] +} \ No newline at end of file diff --git a/template/app.js b/template/app.js index 0dfc0b7..55b0f3e 100644 --- a/template/app.js +++ b/template/app.js @@ -36,9 +36,13 @@ App({ wx.getSystemInfo({ success: e => { this.globalData.StatusBar = e.statusBarHeight; - let custom = wx.getMenuButtonBoundingClientRect(); - this.globalData.Custom = custom; - this.globalData.CustomBar = custom.bottom + custom.top - e.statusBarHeight; + let capsule = wx.getMenuButtonBoundingClientRect(); + if (capsule) { + this.globalData.Custom = capsule; + this.globalData.CustomBar = capsule.bottom + capsule.top - e.statusBarHeight; + } else { + this.globalData.CustomBar = e.statusBarHeight + 50; + } } }) },