1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
| <script lang="ts">
| import type { PropType } from 'vue';
|
| import type { DescriptionsItemSpan, DescriptionsRenderNode } from './types';
|
| import { defineComponent } from 'vue';
|
| import { DESCRIPTIONS_ITEM_NAME } from './use-descriptions';
|
| /**
| * 子节点用法的标记组件,本身不渲染任何内容。
| * 其 props 与默认插槽会被父级 VbenDescriptions 收集为列表项。
| */
| const VbenDescriptionsItem = defineComponent({
| name: DESCRIPTIONS_ITEM_NAME,
| props: {
| content: {
| default: undefined,
| type: [
| String,
| Number,
| Function,
| Object,
| ] as PropType<DescriptionsRenderNode>,
| },
| contentStyle: {
| default: undefined,
| type: Object,
| },
| label: {
| default: undefined,
| type: [
| String,
| Number,
| Function,
| Object,
| ] as PropType<DescriptionsRenderNode>,
| },
| labelStyle: {
| default: undefined,
| type: Object,
| },
| span: {
| default: undefined,
| type: [Number, String, Object] as PropType<DescriptionsItemSpan>,
| },
| },
| setup() {
| return () => null;
| },
| });
|
| // 额外标记,便于在 vnode 中稳健识别
| (VbenDescriptionsItem as Record<string, any>).__isDescriptionsItem = true;
|
| export default VbenDescriptionsItem;
| </script>
|
|