verce-vue-test 0.0.87 → 0.0.88

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": "verce-vue-test",
3
- "version": "0.0.87",
3
+ "version": "0.0.88",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -32,7 +32,23 @@ const layoutOptions: ForeignSettlementLayoutOption[] = [
32
32
  { label: '上下卡片', value: 'vertical', icon: Menu },
33
33
  { label: '左右卡片', value: 'horizontal', icon: Grid },
34
34
  ]
35
- const cardLayout = ref<ForeignSettlementCardLayout>('horizontal')
35
+ const CARD_LAYOUT_STORAGE_KEY = 'foreign-currency-settlement:card-layout'
36
+ const DEFAULT_CARD_LAYOUT: ForeignSettlementCardLayout = 'horizontal'
37
+
38
+ function restoreCardLayout(): ForeignSettlementCardLayout {
39
+ if (typeof window === 'undefined') return DEFAULT_CARD_LAYOUT
40
+
41
+ try {
42
+ const storedLayout = window.localStorage.getItem(CARD_LAYOUT_STORAGE_KEY)
43
+ if (storedLayout === 'horizontal' || storedLayout === 'vertical') return storedLayout
44
+ } catch {
45
+ // 浏览器禁用本地存储时继续使用默认布局,不影响页面进入。
46
+ }
47
+
48
+ return DEFAULT_CARD_LAYOUT
49
+ }
50
+
51
+ const cardLayout = ref<ForeignSettlementCardLayout>(restoreCardLayout())
36
52
 
37
53
  /**
38
54
  * 与人民币手工核销保持相同的父子职责:路由页只组合两个业务组件,
@@ -113,6 +129,12 @@ async function toggleFullscreen() {
113
129
 
114
130
  function setCardLayout(layout: ForeignSettlementCardLayout) {
115
131
  cardLayout.value = layout
132
+
133
+ try {
134
+ window.localStorage.setItem(CARD_LAYOUT_STORAGE_KEY, layout)
135
+ } catch {
136
+ // 本地存储不可用时仅保留本次页面状态。
137
+ }
116
138
  }
117
139
 
118
140
  function closePageTransientOverlays() {