Skip to content

Commit c58ec22

Browse files
committed
更新[BoxJs]: 修复手势前进后退会白屏&卡屏问题
1 parent 3b731d6 commit c58ec22

3 files changed

Lines changed: 19 additions & 11 deletions

File tree

‎box/chavy.boxjs.html‎

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1543,7 +1543,6 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
15431543
watch: {
15441544
'ui.path': {
15451545
handler(newval, oldval) {
1546-
this.handleHistory(newval)
15471546
if (/^\/#/.test(newval)) {
15481547
newval = newval.replace('/#', '')
15491548
}
@@ -1680,7 +1679,7 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
16801679
(error) => (this.isLoading = false)
16811680
)
16821681
},
1683-
async created() {
1682+
created() {
16841683
// 如果 url 参数中指定的 baseURL, 则后续的请求都请求到指定的域
16851684
if (window.location.search) {
16861685
const [, baseURL] = /baseURL=(.*?)(&|$)/.exec(window.location.search)
@@ -1695,17 +1694,18 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
16951694
} else {
16961695
this.path = defview
16971696
}
1697+
this.handleHistory(this.path)
16981698
// 监听浏览器后退事件
16991699
window.addEventListener('popstate', (e) => (this.path = e.state.url), false)
17001700
// 如果后端没有渲染数据, 则发出请求获取数据
17011701
if (this.boxServerData) {
17021702
this.box = this.boxServerData
17031703
} else {
1704-
await axios.get('/query/boxdata').then((resp) => (this.box = resp.data))
1704+
axios.get('/query/boxdata').then((resp) => (this.box = resp.data))
17051705
}
17061706
// 获取全局备份
17071707
if (this.view === 'bak') {
1708-
await this.loadGlobalBak()
1708+
this.loadGlobalBak()
17091709
}
17101710
this.getVersions()
17111711
this.loadTheme()
@@ -1726,8 +1726,10 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
17261726
back() {
17271727
if (this.view === 'bak' && !this.bfpath) {
17281728
this.path = '/#/my'
1729+
this.handleHistory(this.path)
17291730
} else if (this.view === 'app' && !this.bfpath) {
17301731
this.path = '/#/app'
1732+
this.handleHistory(this.path)
17311733
} else {
17321734
history.back()
17331735
}
@@ -1741,6 +1743,7 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
17411743
path = `/#/${path}`
17421744
if (this.path !== path) {
17431745
this.path = path
1746+
this.handleHistory(this.path)
17441747
} else {
17451748
const scrollY = this.ui.scrollY[this.path]
17461749
const isTopY = _.isNil(scrollY) || scrollY === 0
@@ -1758,6 +1761,7 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
17581761
switchAppView(appId) {
17591762
const path = `/#/app/${appId}`
17601763
this.path = path
1764+
this.handleHistory(this.path)
17611765
},
17621766
// 切换备份视图
17631767
switchBakView(bakId) {
@@ -1767,6 +1771,7 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
17671771
this.loadGlobalBak().then((resp) => (this.path = path))
17681772
} else {
17691773
this.path = path
1774+
this.handleHistory(this.path)
17701775
}
17711776
},
17721777
// 重载主题

‎box/chavy.boxjs.js‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const $ = new Env('BoxJs')
22

3-
$.version = '0.7.34'
3+
$.version = '0.7.35'
44
$.versionType = 'beta'
55

66
/**
@@ -126,6 +126,7 @@ async function handlePage() {
126126

127127
// 调试模式: 是否每次都获取新的页面
128128
const isDebugWeb = [true, 'true'].includes($.getdata('@chavy_boxjs_userCfgs.isDebugWeb'))
129+
const debugger_web = $.getjson('chavy_boxjs_userCfgs').debugger_web
129130
const cache = $.getjson($.KEY_web_cache, null)
130131

131132
// 如果没有开启调试模式,且当前版本与缓存版本一致,且直接取缓存
@@ -134,9 +135,10 @@ async function handlePage() {
134135
}
135136
// 如果开启了调试模式,并指定了 `debugger_web` 则从指定的地址获取页面
136137
else {
137-
const debugger_web = $.getjson('chavy_boxjs_userCfgs').debugger_web
138138
if (isDebugWeb && debugger_web) {
139-
$.web = debugger_web
139+
// 调试地址后面拼时间缀, 避免 GET 缓存
140+
const isQueryUrl = debugger_web.includes('?')
141+
$.web = `${debugger_web}${isQueryUrl ? '&' : '?'}_=${new Date().getTime()}`
140142
boxdata.syscfgs.isDebugMode = true
141143
console.log(`[WARN] 调试模式: $.web = : ${$.web}`)
142144
}
@@ -177,8 +179,9 @@ async function handlePage() {
177179
*/
178180
$.html = $.html.replace('boxServerData: null', 'boxServerData:' + JSON.stringify(boxdata))
179181

180-
// 调试模式支持 vue Devtools
181-
if (isDebugWeb) {
182+
// 调试模式支持 vue Devtools (只有在同时开启调试模式和指定了调试地址才生效)
183+
// vue.min.js 生效时, 会导致 @click="window.open()" 报 "window" is not defined 错误
184+
if (isDebugWeb && debugger_web) {
182185
$.html = $.html.replace('vue.min.js', 'vue.js')
183186
}
184187
}

‎box/release/box.release.tf.json‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"releases": [
33
{
4-
"version": "0.7.34",
4+
"version": "0.7.35",
55
"tags": ["beta"],
66
"author": "@chavyleung",
77
"icon": "https://avatars3.githubusercontent.com/u/29748519",
@@ -13,7 +13,7 @@
1313
},
1414
{
1515
"name": "修复",
16-
"descs": ["底栏事件无效问题", "部分情况下贡献者重复加载问题"]
16+
"descs": ["底栏事件无效问题", "部分情况下贡献者重复加载问题", "手势前进后退会白屏&卡屏问题"]
1717
}
1818
]
1919
},

0 commit comments

Comments
 (0)