用 window.innerWidth 代替 window.screen.width,因为 screen 包括了开发工具窗
This commit is contained in:
parent
37471f5d3d
commit
4a96e6a66f
15
usertool.js
15
usertool.js
@ -97,7 +97,7 @@ export default {
|
|||||||
if (pagesJson?.topWindow || envar?.Hide_Bars_On_PC) {
|
if (pagesJson?.topWindow || envar?.Hide_Bars_On_PC) {
|
||||||
// 如果页头不是通过 pagesJson.topWindow 而是作为组件来引入个别页面,那么定义配置参数 Hide_Bars_On_PC 来控制。
|
// 如果页头不是通过 pagesJson.topWindow 而是作为组件来引入个别页面,那么定义配置参数 Hide_Bars_On_PC 来控制。
|
||||||
if (uni.getSystemInfoSync().model === 'PC') {
|
if (uni.getSystemInfoSync().model === 'PC') {
|
||||||
if (window.screen.width > (pagesJson?.topWindow?.matchMedia?.minWidth || 0)) {
|
if (window.innerWidth > (pagesJson?.topWindow?.matchMedia?.minWidth || 0)) {
|
||||||
uni.hideTabBar()
|
uni.hideTabBar()
|
||||||
// 不知为何,同一个二级页面,如果第二次进入,就仍然会显示 navibar, 必须通过 setTimeout 执行才能彻底隐藏。
|
// 不知为何,同一个二级页面,如果第二次进入,就仍然会显示 navibar, 必须通过 setTimeout 执行才能彻底隐藏。
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -549,10 +549,10 @@ export default {
|
|||||||
}, 1000)
|
}, 1000)
|
||||||
},
|
},
|
||||||
|
|
||||||
// 注意,即使在 PC 上 topWindow 代替了 tabBar 时,从标签页转化而来的菜单页,也是用 switchTab 跳转。
|
|
||||||
goto_page (pageName, { forget = false, pagesJson = this.pagesJson || wo?.pagesJson } = {}) {
|
goto_page (pageName, { forget = false, pagesJson = this.pagesJson || wo?.pagesJson } = {}) {
|
||||||
if (pageName) {
|
if (pageName) {
|
||||||
if (pagesJson?.tabBar?.list?.find((item) => item?.pagePath?.substr(6) === pageName)) {
|
if (pagesJson?.tabBar?.list?.find((item) => item?.pagePath?.substr(6) === pageName)) {
|
||||||
|
// 注意,即使在 PC 上 topWindow 代替了 tabBar 时,从标签页转化而来的菜单页,也是用 switchTab 跳转。
|
||||||
uni.switchTab({ url: pageName })
|
uni.switchTab({ url: pageName })
|
||||||
} else if (forget) {
|
} else if (forget) {
|
||||||
uni.navigateTo({ url: pageName })
|
uni.navigateTo({ url: pageName })
|
||||||
@ -564,4 +564,15 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
next_focus(currentFocus, focusList=this.thisPage().focusList){
|
||||||
|
if (focusList) {
|
||||||
|
for (let n in focusList) {
|
||||||
|
focusList[n]=false
|
||||||
|
}
|
||||||
|
setTimeout(()=>{
|
||||||
|
focusList[(parseInt(currentFocus)+1) % Object.keys(focusList).length]=true
|
||||||
|
},200) // 如果没有 setTimeout 至少 200ms, 焦点短暂跳到下一个后,又会消失
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user