From a05bb496b45c38f6a784337922794aa7bee4e76f Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Wed, 16 Mar 2022 10:43:00 +0800 Subject: [PATCH] =?UTF-8?q?=E6=94=B9=E9=80=A0=20setBarTitles=20=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=93=8D=E5=BA=94=E5=BC=8F=E6=98=BE=E7=A4=BA=E6=88=96?= =?UTF-8?q?=E9=9A=90=E8=97=8F=20tabbar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- index.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/index.js b/index.js index 478fe5b..877c19b 100644 --- a/index.js +++ b/index.js @@ -12,6 +12,9 @@ export default { BLACK_TOAST: 'default', WHITE_BUTTON: 'default', + // internal consts used by unitool + RESPONSIVE: false, + RESPONSIVE_WIDTH_THRESHOLD: 768.768, BACKEND: 'SERVER', // 通过变量来动态切换后台类型:服务器 SERVER,或云服务 CLOUD。应当根据实际需要,在前端所用的 unitool 里覆盖。 thisPage() { @@ -96,6 +99,21 @@ export default { } }) // uni.showTabBar({}) + + // #ifdef H5 + if (this.RESPONSIVE && uni.getSystemInfoSync().model==='PC') { + if (window.screen.width > this.RESPONSIVE_WIDTH_THRESHOLD) { + uni.hideTabBar() + } + uni.onWindowResize(({size})=>{ + if (size.windowWidth > this.RESPONSIVE_WIDTH_THRESHOLD) { + uni.hideTabBar() + }else{ + uni.showTabBar() + } + }) + } + // #endif }, makeServerUrl(route = '') {