tang-ui-x 1.3.7 → 1.3.8

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.
@@ -41,10 +41,14 @@ const hasItemBadge = (item: TabItem): boolean => {
41
41
  return item.badge != null && item.badge !== ''
42
42
  }
43
43
 
44
+ const isEmptyKey = (value: string | number | null): boolean => {
45
+ return value == null || (typeof value === 'string' && value === '')
46
+ }
47
+
44
48
  /** 获取默认激活项的 key */
45
49
  const getDefaultKey = (): string | number => {
46
50
  const defaultActiveKey = props.defaultActiveKey
47
- if (defaultActiveKey !== null) {
51
+ if (defaultActiveKey != null) {
48
52
  return defaultActiveKey
49
53
  }
50
54
  if (props.items.length > 0) {
@@ -61,17 +65,17 @@ const getDefaultKey = (): string | number => {
61
65
 
62
66
  /** 初始化默认激活项 */
63
67
  onMounted(() => {
64
- if (model.value == null || model.value == '') {
68
+ if (isEmptyKey(model.value)) {
65
69
  model.value = getDefaultKey()
66
70
  }
67
71
  })
68
72
 
69
73
  const isItemActive = (item: TabItem): boolean => {
70
74
  const currentKey = model.value
71
- if (currentKey == null || currentKey == '') {
75
+ if (isEmptyKey(currentKey)) {
72
76
  return false
73
77
  }
74
- if (item.key == null || item.key == '') {
78
+ if (isEmptyKey(item.key)) {
75
79
  return false
76
80
  }
77
81
  return item.key == currentKey
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tang-ui-x",
3
- "version": "1.3.7",
3
+ "version": "1.3.8",
4
4
  "description": "UniApp X UI 组件库 - 基于 uni-app x 的移动端 UI 组件库",
5
5
  "main": "index.uts",
6
6
  "module": "index.uts",
@@ -158,7 +158,7 @@ export function generateStorageKey(prefix: string, key: string): string {
158
158
  }
159
159
 
160
160
  // 检查 存储支持
161
- export function checkStorageSupport(storageType: 'sync'): boolean {
161
+ export function checkStorageSupport(_storageType: 'sync'): boolean {
162
162
  try {
163
163
  // uni-app x 天然支持同步存储
164
164
  const testKey = '__storage_test__'