From de4aa72ed765168cc437b08c3caf80c61a23f09d Mon Sep 17 00:00:00 2001 From: Luk Lu Date: Wed, 16 Mar 2022 20:35:45 +0800 Subject: [PATCH] u --- index.js | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/index.js b/index.js index 877c19b..400ca57 100644 --- a/index.js +++ b/index.js @@ -13,8 +13,9 @@ export default { WHITE_BUTTON: 'default', // internal consts used by unitool - RESPONSIVE: false, - RESPONSIVE_WIDTH_THRESHOLD: 768.768, + RESPONSIVE_TABBAR_AUTOHIDE: false, + RESPONSIVE_TABBAR_AUTOHIDE_WIDTH_THRESHOLD: 768.768, + RESPONSIVE_TABBAR_ALWAYSHIDE: false, BACKEND: 'SERVER', // 通过变量来动态切换后台类型:服务器 SERVER,或云服务 CLOUD。应当根据实际需要,在前端所用的 unitool 里覆盖。 thisPage() { @@ -101,17 +102,21 @@ export default { // uni.showTabBar({}) // #ifdef H5 - if (this.RESPONSIVE && uni.getSystemInfoSync().model==='PC') { - if (window.screen.width > this.RESPONSIVE_WIDTH_THRESHOLD) { + if (uni.getSystemInfoSync().model==='PC') { + if (this.RESPONSIVE_TABBAR_AUTOHIDE) { + 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() + } + }) + }else if (this.RESPONSIVE_TABBAR_ALWAYSHIDE) { uni.hideTabBar() } - uni.onWindowResize(({size})=>{ - if (size.windowWidth > this.RESPONSIVE_WIDTH_THRESHOLD) { - uni.hideTabBar() - }else{ - uni.showTabBar() - } - }) } // #endif },