wui-components-v2 1.1.86 → 1.1.87

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.
@@ -27,7 +27,9 @@ const { currentThemeColor } = useManualTheme()
27
27
  // 展示内容
28
28
  const exhibitData = computed(() => {
29
29
  const { collapseNum } = props
30
- const num = collapseNum || 2
30
+ // collapseNum 0 时,只显示标题,不展示任何字段数据
31
+ if (collapseNum === 0) return []
32
+ const num = collapseNum || 5
31
33
  const columns = props.columns.length >= num ? props.columns.slice(0, num) : props.columns
32
34
  return columns.filter(item => item.title !== '操作')
33
35
  })
@@ -35,7 +37,9 @@ const exhibitData = computed(() => {
35
37
  // 是否展示折叠按钮
36
38
  const showCollapse = computed(() => {
37
39
  const { collapseNum } = props
38
- const num = collapseNum || 2
40
+ // collapseNum 0 时,默认收起全部字段,仍可点击展开
41
+ if (collapseNum === 0) return true
42
+ const num = collapseNum || 5
39
43
  return props.columns.length > num
40
44
  })
41
45
 
@@ -58,8 +62,14 @@ function toggleCollapse(contentId: string) {
58
62
  console.log(contentId)
59
63
  if (collapseIcon.value === 'arrow-down') {
60
64
  const { collapseNum } = props
61
- const num = collapseNum || 2
62
- const columns = props.columns.length >= num ? props.columns.slice(num) : []
65
+ let columns: Columns[]
66
+ if (collapseNum === 0) {
67
+ // 默认不展示任何字段,展开时显示全部
68
+ columns = props.columns
69
+ } else {
70
+ const num = collapseNum || 5
71
+ columns = props.columns.length >= num ? props.columns.slice(num) : []
72
+ }
63
73
  collapseData.value = columns.filter(item => item.title !== '操作')
64
74
  // 展开
65
75
  // content.classList.remove('max-h-0')
@@ -17,6 +17,11 @@ defineOptions({
17
17
  })
18
18
  defineProps<{
19
19
  detailButtonHandle?: (data: Entities) => void
20
+ /**
21
+ * 折叠前展示的数据条数,透传给 foldCard。
22
+ * 不传时默认 2;传 0 表示只显示标题、不展示任何字段数据。
23
+ */
24
+ collapseNum?: number
20
25
  }>()
21
26
 
22
27
  const Zpaging = ref<any>(null)
@@ -246,7 +251,7 @@ function tabSearchClick(data: any) {
246
251
  :key="item.code"
247
252
  :index="index"
248
253
  :enum-column="enumColumn"
249
- :collapse-num="5"
254
+ :collapse-num="collapseNum"
250
255
  :source-id="sourceId"
251
256
  :groups="config"
252
257
  :data="item"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wui-components-v2",
3
- "version": "1.1.86",
3
+ "version": "1.1.87",
4
4
  "description": "wui 组件库",
5
5
  "author": "wgxshh",
6
6
  "license": "MIT",