rayyy-vue-table-components 2.0.16 → 2.0.18

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.
@@ -33,7 +33,6 @@ declare const __VLS_component: import('vue').DefineComponent<__VLS_Props, {}, {}
33
33
  onUpdatePage?: ((page: number) => any) | undefined;
34
34
  onUpdatePageSize?: ((limit: number) => any) | undefined;
35
35
  }>, {
36
- locale: Language;
37
36
  pageSizeList: number[];
38
37
  }, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
39
38
  declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rayyy-vue-table-components",
3
- "version": "2.0.16",
3
+ "version": "2.0.18",
4
4
  "description": "Vue 3 + Element Plus 表格組件庫",
5
5
  "type": "module",
6
6
  "main": "./dist/index.umd.js",
@@ -4,7 +4,6 @@ import type { Pager } from '@/types'
4
4
  import { MainPanel, SearchBar } from '@/components'
5
5
  import { useComponentElementLocale } from '@/utils/i18n'
6
6
  import type { Language } from 'element-plus/es/locale'
7
- import zhTw from 'element-plus/es/locale/lang/zh-tw'
8
7
 
9
8
  const props = withDefaults(
10
9
  defineProps<{
@@ -14,11 +13,10 @@ const props = withDefaults(
14
13
  showSearch?: boolean
15
14
  pageSizeList?: number[]
16
15
  showPagination?: boolean
17
- locale?: Language // 新增:Element Plus locale
16
+ locale?: Language // 新增:Element Plus locale
18
17
  }>(),
19
18
  {
20
19
  pageSizeList: () => [10, 25, 50, 100, 200],
21
- locale: () => zhTw, // 預設值:中文
22
20
  },
23
21
  )
24
22
 
@@ -53,17 +51,21 @@ const showPager = computed(() => {
53
51
  if (props.showPagination) {
54
52
  return props.showPagination
55
53
  } else {
56
- return props.pagination.totalCount > 0
54
+ return props.pagination.totalCount > 0
57
55
  }
58
56
  })
59
57
 
58
+ // 在 computed 外部調用,保持引用穩定
59
+ const fallbackLocale = useComponentElementLocale()
60
+
60
61
  // 優先使用 prop,沒有 prop 則使用 composable
61
62
  const elementLocale = computed(() => {
62
- if (props.locale) {
63
+ // 檢查 props.locale 是否為真正的 Language 對象(不是預設值)
64
+ if (props.locale && typeof props.locale === 'object' && 'name' in props.locale) {
63
65
  return props.locale
64
66
  }
65
- // 回退:使用簡化的 composable
66
- return useComponentElementLocale().value
67
+ // 現在能正確追蹤響應式
68
+ return fallbackLocale.value
67
69
  })
68
70
  </script>
69
71