Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 61f117f

Browse files
authored
Merge pull request chavyleung#221 from id77/master
更新[BoxJs TF]: 优化页面后退事件逻辑
2 parents 8deb741 + 043eef2 commit 61f117f

File tree

3 files changed

+20
-12
lines changed

3 files changed

+20
-12
lines changed

box/chavy.boxjs.html

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,7 +1841,6 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
18411841
} else {
18421842
this.path = defview
18431843
}
1844-
this.handleHistory(this.path)
18451844
// 监听浏览器后退事件
18461845
window.addEventListener('popstate', (e) => (this.path = e.state.url), false)
18471846
// 如果后端没有渲染数据, 则发出请求获取数据
@@ -1909,23 +1908,18 @@ <h2 :class="version === ver.version ? 'primary--text' : undefined">v{{ver.versio
19091908
this.ui.isWaitToggleSearchBar = false
19101909
}, 1000),
19111910
handleHistory(path) {
1912-
const state = { title: 'BoxJs', url: path }
1911+
const { hash } = window.location.href;
1912+
const state = { title: 'BoxJs', url: '/' + (hash ? hash : '#/') }
19131913
if (!history.state) {
19141914
history.replaceState(state, '')
19151915
}
1916+
1917+
state.url = path;
19161918
history.pushState(state, '', path)
19171919
},
19181920
// 页面返回
19191921
back() {
1920-
if (this.view === 'bak' && !this.bfpath) {
1921-
this.path = '/#/my'
1922-
this.handleHistory(this.path)
1923-
} else if (this.view === 'app' && !this.bfpath) {
1924-
this.path = '/#/app'
1925-
this.handleHistory(this.path)
1926-
} else {
1927-
history.back()
1928-
}
1922+
history.back()
19291923
},
19301924
// 切换当前容器环境
19311925
switchEnv(env) {

box/chavy.boxjs.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const $ = new Env('BoxJs')
33
// 为 eval 准备的上下文环境
44
const $eval_env = {}
55

6-
$.version = '0.7.49'
6+
$.version = '0.7.50'
77
$.versionType = 'beta'
88

99
/**

box/release/box.release.tf.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,19 @@
11
{
22
"releases": [
3+
{
4+
"version": "0.7.50",
5+
"tags": ["beta"],
6+
"author": "@id77",
7+
"icon": "https://avatars3.githubusercontent.com/u/29748519",
8+
"repo": "https://github.com/chavyleung",
9+
"msg": "更新[BoxJs TF]: 优化页面后退事件逻辑",
10+
"notes": [
11+
{
12+
"name": "优化",
13+
"descs": ["页面后退事件逻辑"]
14+
}
15+
]
16+
},
317
{
418
"version": "0.7.49",
519
"tags": ["beta"],

0 commit comments

Comments
 (0)