@gm-pc/react 1.13.3-alpha.0 → 1.13.3-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gm-pc/react",
3
- "version": "1.13.3-alpha.0",
3
+ "version": "1.13.3-alpha.1",
4
4
  "description": "观麦前端基础组件库",
5
5
  "author": "liyatang <liyatang@qq.com>",
6
6
  "homepage": "https://github.com/gmfe/gm-pc#readme",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "@gm-common/hooks": "^2.10.0",
26
26
  "@gm-common/tool": "^2.10.0",
27
- "@gm-pc/locales": "^1.13.3-alpha.0",
27
+ "@gm-pc/locales": "^1.13.3-alpha.1",
28
28
  "big.js": "^6.0.1",
29
29
  "classnames": "^2.2.5",
30
30
  "lodash": "^4.17.19",
@@ -48,5 +48,5 @@
48
48
  "react-router-dom": "^5.2.0",
49
49
  "react-window": "^1.8.5"
50
50
  },
51
- "gitHead": "8f4025e778efd916867e985fd61ccdeaa842e441"
51
+ "gitHead": "4605da606ef3651da81968ad6802fae8806a10d6"
52
52
  }
@@ -89,6 +89,10 @@ vbrowser 暴露了以下属性和方法,详细信息见类型声明/代码提
89
89
 
90
90
  隐藏窗口管理栏,可以用于进入全屏模式的场景;
91
91
 
92
+ - `clearSession`
93
+
94
+ 清除会话缓存,使重新进入不恢复vbrowser窗口标签栏
95
+
92
96
  - `on`
93
97
 
94
98
  事件监听, `'error' | 'change' | 'close' | 'show'`,分别对应错误、窗口切换、窗口关闭、窗口激活事件;
@@ -36,7 +36,7 @@ class VBrowser implements VBrowser {
36
36
  </BrowserContext.Provider>
37
37
  )
38
38
  // this.open = debounce(this.open).bind(this) as typeof this.open
39
- this._loadStash().then(async () => {
39
+ this._restoreSession().then(async () => {
40
40
  await when(() => this.mounted)
41
41
  this.props.onReady && this.props.onReady()
42
42
  return null
@@ -81,7 +81,7 @@ class VBrowser implements VBrowser {
81
81
 
82
82
  this.props.onChange &&
83
83
  this.props.onChange(oldWindow, this.windows[this.activeIndex], this.windows)
84
- this._stash()
84
+ this._stashSession()
85
85
  }
86
86
 
87
87
  /** 打开新子窗口, 子窗口已存在则判断query是否相等,相等则切换,不相等则隐性销毁重新加载;子窗口不存在则新建子窗口;
@@ -215,7 +215,7 @@ class VBrowser implements VBrowser {
215
215
  }
216
216
 
217
217
  // 保存已开窗口
218
- private async _stash() {
218
+ private async _stashSession() {
219
219
  const windows = this.windows.slice().map((item) => ({ ...item }))
220
220
  const string = JSON.stringify({
221
221
  windows,
@@ -225,7 +225,7 @@ class VBrowser implements VBrowser {
225
225
  }
226
226
 
227
227
  // 恢复已开窗口
228
- private async _loadStash() {
228
+ private async _restoreSession() {
229
229
  await new Promise((resolve) => setTimeout(resolve, 100))
230
230
  const { windows = [], activeIndex = 0 } = JSON.parse(
231
231
  sessionStorage.getItem(VBROWSER_STORAGE_KEY) || '{}'
@@ -235,6 +235,11 @@ class VBrowser implements VBrowser {
235
235
  this.open(windows[activeIndex])
236
236
  }
237
237
 
238
+ /** 清除会话缓存,使重新进入不恢复vbrowser窗口标签栏 */
239
+ clearSession() {
240
+ sessionStorage.removeItem(VBROWSER_STORAGE_KEY)
241
+ }
242
+
238
243
  /** 隐藏标签栏 */
239
244
  hideTabs() {
240
245
  this._hidingTabs = true