xt-element-ui 1.4.0 → 2.0.0

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.
Files changed (90) hide show
  1. package/CHANGELOG.md +37 -20
  2. package/README.md +39 -35
  3. package/docs/README.md +25 -15
  4. package/docs/components/base/xt-badge.md +139 -0
  5. package/docs/components/base/xt-bar.md +182 -0
  6. package/docs/components/base/xt-chart.md +183 -0
  7. package/docs/components/base/xt-date-picker.md +111 -0
  8. package/docs/components/base/xt-icon.md +154 -0
  9. package/docs/components/base/xt-line.md +145 -0
  10. package/docs/components/base/xt-multi.md +278 -0
  11. package/docs/components/base/xt-page.md +84 -0
  12. package/docs/components/base/xt-pie.md +175 -0
  13. package/docs/components/base/xt-progress.md +134 -0
  14. package/docs/components/base/xt-select-tree.md +141 -0
  15. package/docs/components/base/xt-table.md +344 -0
  16. package/docs/components/base/xt-tabs.md +197 -0
  17. package/docs/components/base/xt-upload.md +85 -0
  18. package/lib/index.common.js +479 -821
  19. package/lib/index.css +1 -1
  20. package/lib/index.umd.js +484 -827
  21. package/lib/index.umd.min.js +5 -5
  22. package/package.json +1 -1
  23. package/src/components/index.scss +2 -8
  24. package/src/components/xt-button/index.js +8 -8
  25. package/src/components/xt-button/index.vue +43 -73
  26. package/src/components/xt-button/style/index.scss +51 -787
  27. package/src/components/xt-card/index.js +7 -8
  28. package/src/components/xt-card/index.vue +61 -21
  29. package/src/components/xt-card/style/index.scss +56 -32
  30. package/src/components/xt-card-item/index.vue +3 -3
  31. package/src/components/xt-chart/index.js +8 -0
  32. package/src/components/{ex-chart → xt-chart}/index.vue +13 -13
  33. package/src/components/{ex-chart → xt-chart}/pieList.vue +1 -1
  34. package/src/components/{ex-chart → xt-chart}/utils.js +1 -1
  35. package/src/components/xt-config-provider/index.vue +1 -1
  36. package/src/components/xt-date-picker/index.js +8 -0
  37. package/src/components/{ex-date-picker → xt-date-picker}/index.vue +1 -1
  38. package/src/components/xt-icon/index.js +8 -0
  39. package/src/components/{ex-icon → xt-icon}/index.vue +4 -4
  40. package/src/components/xt-layout/ExFieldset.vue +1 -1
  41. package/src/components/xt-page/index.js +8 -0
  42. package/src/components/{ex-page → xt-page}/index.vue +1 -1
  43. package/src/components/xt-select-tree/index.js +8 -0
  44. package/src/components/{ex-select-tree → xt-select-tree}/index.vue +1 -1
  45. package/src/components/{ex-table/ExTableCell.vue → xt-table/XtTableCell.vue} +1 -1
  46. package/src/components/xt-table/index.js +8 -0
  47. package/src/components/{ex-table → xt-table}/index.vue +6 -6
  48. package/src/components/xt-upload/index.js +8 -0
  49. package/src/index.js +15 -29
  50. package/src/utils/index.js +1 -1
  51. package/docs/components/extend/ex-bar.md +0 -68
  52. package/docs/components/extend/ex-button.md +0 -62
  53. package/docs/components/extend/ex-card.md +0 -86
  54. package/docs/components/extend/ex-chart.md +0 -463
  55. package/docs/components/extend/ex-date-picker.md +0 -0
  56. package/docs/components/extend/ex-icon.md +0 -189
  57. package/docs/components/extend/ex-line.md +0 -71
  58. package/docs/components/extend/ex-multi.md +0 -156
  59. package/docs/components/extend/ex-page.md +0 -0
  60. package/docs/components/extend/ex-pie.md +0 -70
  61. package/docs/components/extend/ex-select-tree.md +0 -210
  62. package/docs/components/extend/ex-table.md +0 -591
  63. package/docs/components/extend/ex-upload.md +0 -134
  64. package/src/components/ex-button/index.js +0 -8
  65. package/src/components/ex-button/index.vue +0 -67
  66. package/src/components/ex-button/style/index.scss +0 -67
  67. package/src/components/ex-card/index.js +0 -7
  68. package/src/components/ex-card/index.vue +0 -68
  69. package/src/components/ex-card/style/index.scss +0 -73
  70. package/src/components/ex-chart/index.js +0 -8
  71. package/src/components/ex-date-picker/index.js +0 -8
  72. package/src/components/ex-icon/index.js +0 -8
  73. package/src/components/ex-page/index.js +0 -8
  74. package/src/components/ex-select-tree/index.js +0 -8
  75. package/src/components/ex-table/index.js +0 -8
  76. package/src/components/ex-upload/index.js +0 -8
  77. package/src/config/element-registry.js +0 -136
  78. /package/src/components/{ex-chart/ExBar.vue → xt-chart/XtBar.vue} +0 -0
  79. /package/src/components/{ex-chart/ExLine.vue → xt-chart/XtLine.vue} +0 -0
  80. /package/src/components/{ex-chart/ExMulti.vue → xt-chart/XtMulti.vue} +0 -0
  81. /package/src/components/{ex-chart/ExPie.vue → xt-chart/XtPie.vue} +0 -0
  82. /package/src/components/{ex-chart → xt-chart}/theme/dark.js +0 -0
  83. /package/src/components/{ex-chart → xt-chart}/theme/white.js +0 -0
  84. /package/src/components/{ex-date-picker → xt-date-picker}/SearchDate.vue +0 -0
  85. /package/src/components/{ex-date-picker → xt-date-picker}/quarter.vue +0 -0
  86. /package/src/components/{ex-icon → xt-icon}/style/index.scss +0 -0
  87. /package/src/components/{ex-table → xt-table}/VirtualElTable.vue +0 -0
  88. /package/src/components/{ex-table → xt-table}/virtualScrollData.js +0 -0
  89. /package/src/components/{ex-upload → xt-upload}/index.vue +0 -0
  90. /package/src/components/{ex-upload → xt-upload}/preview.vue +0 -0
@@ -1,189 +0,0 @@
1
- ## ExIcon 图标
2
-
3
- 统一图标组件,支持 ElementUI 字体图标(el-icon)、SVG Sprite 图标、内联 SVG,以及可扩展的自定义字体图标。
4
-
5
- ## 基础用法:ElementUI 字体图标
6
-
7
- `name` 以 `el-icon-` 开头时,自动识别为 ElementUI 字体图标:
8
-
9
- ::: demo ElementUI 字体图标示例
10
- ```vue
11
- <template>
12
- <div style="font-size: 24px">
13
- <ex-icon name="el-icon-edit" style="margin-right: 16px" />
14
- <ex-icon name="el-icon-delete" style="margin-right: 16px" />
15
- <ex-icon name="el-icon-search" style="margin-right: 16px" />
16
- <ex-icon name="el-icon-share" style="margin-right: 16px" />
17
- <ex-icon name="el-icon-setting" />
18
- </div>
19
- </template>
20
- ```
21
- :::
22
-
23
- ## SVG Sprite 图标
24
-
25
- `name` 以 `#` 或 `svg:` 开头时,自动识别为 SVG Sprite(通过 `<use>` 引用)。使用前请确保项目已通过 `svg-sprite-loader` 等方式注册了对应的 SVG 图标:
26
-
27
- ::: demo SVG Sprite 图标示例
28
- ```vue
29
- <template>
30
- <div style="font-size: 24px; color: #1890ff">
31
- <ex-icon name="#icon-user" style="margin-right: 16px" />
32
- <ex-icon name="svg:icon-home" style="margin-right: 16px" />
33
- <ex-icon name="#icon-star" />
34
- </div>
35
- </template>
36
- ```
37
- :::
38
-
39
- ## 内联 SVG 图标
40
-
41
- `name` 传入完整的 `<svg>` 字符串时,将作为内联 SVG 渲染:
42
-
43
- ::: demo 内联 SVG 示例
44
- ```vue
45
- <template>
46
- <ex-icon
47
- :size="32"
48
- color="#f56c6c"
49
- :name="'<svg viewBox=&quot;0 0 1024 1024&quot;><path d=&quot;M512 938.666667L85.333333 512l170.666667-170.666667 256 256 256-256L938.666667 512 512 938.666667z&quot; fill=&quot;currentColor&quot;></path></svg>'"
50
- />
51
- </template>
52
- ```
53
- :::
54
-
55
- ## 自定义字体图标(本地扩展)
56
-
57
- 除 `el-icon-` 前缀外,其它自定义前缀会自动作为自定义字体图标渲染(需在项目中自行准备 @font-face 字体文件及对应 class)。例如使用 `my-icon-star`:
58
-
59
- ```scss
60
- // 项目中准备好字体文件及 class
61
- @font-face {
62
- font-family: 'my-icon';
63
- src: url('./fonts/my-icon.ttf') format('truetype');
64
- }
65
- .my-icon {
66
- font-family: 'my-icon' !important;
67
- }
68
- .my-icon-star::before {
69
- content: '\e001';
70
- }
71
- ```
72
-
73
- ::: demo 自定义字体图标示例
74
- ```vue
75
- <template>
76
- <div style="font-size: 24px">
77
- <ex-icon name="my-icon-star" style="margin-right: 16px" />
78
- <ex-icon name="my-icon-heart" />
79
- </div>
80
- </template>
81
-
82
- <script>
83
- export default {
84
- created() {
85
- // 注册自定义前缀,避免自动添加 ex-icon 前缀
86
- ExIcon.registerPrefix('my-icon-')
87
- }
88
- }
89
- </script>
90
- ```
91
- :::
92
-
93
- 未注册自定义前缀时,组件会自动为其添加 `ex-icon` 作为基础 class,方便与项目本地的 @font-face 配合:
94
-
95
- ```scss
96
- .ex-icon {
97
- font-family: 'ex-iconfont' !important;
98
- font-size: 16px;
99
- font-style: normal;
100
- }
101
- .ex-icon-star::before { content: '\e001'; }
102
- ```
103
-
104
- ## 尺寸与颜色
105
-
106
- 通过 `size` 和 `color` 属性控制图标大小与颜色:
107
-
108
- ::: demo 图标尺寸颜色示例
109
- ```vue
110
- <template>
111
- <div>
112
- <ex-icon name="el-icon-star-on" :size="16" color="#909399" style="margin-right: 16px" />
113
- <ex-icon name="el-icon-star-on" :size="24" color="#e6a23c" style="margin-right: 16px" />
114
- <ex-icon name="el-icon-star-on" :size="32" color="#f56c6c" style="margin-right: 16px" />
115
- <ex-icon name="el-icon-star-on" :size="48" color="#67c23a" style="margin-right: 16px" />
116
- <ex-icon name="el-icon-star-on" size="2em" color="#409eff" />
117
- </div>
118
- </template>
119
- ```
120
- :::
121
-
122
- ## 旋转动画
123
-
124
- 设置 `spin` 让图标持续旋转(常用于加载状态):
125
-
126
- ::: demo 图标旋转示例
127
- ```vue
128
- <template>
129
- <div style="font-size: 24px">
130
- <ex-icon name="el-icon-loading" spin style="margin-right: 16px" />
131
- <ex-icon name="el-icon-refresh" spin />
132
- </div>
133
- </template>
134
- ```
135
- :::
136
-
137
- ## 点击事件
138
-
139
- 支持 `@click` 事件:
140
-
141
- ::: demo 图标点击示例
142
- ```vue
143
- <template>
144
- <div style="font-size: 24px">
145
- <ex-icon
146
- name="el-icon-favorite"
147
- color="#f56c6c"
148
- @click="handleClick"
149
- style="cursor: pointer"
150
- />
151
- <span style="margin-left: 8px; font-size: 14px">点击次数:{{ count }}</span>
152
- </div>
153
- </template>
154
-
155
- <script>
156
- export default {
157
- data() {
158
- return { count: 0 }
159
- },
160
- methods: {
161
- handleClick() {
162
- this.count++
163
- }
164
- }
165
- }
166
- </script>
167
- ```
168
- :::
169
-
170
- ## Attributes
171
-
172
- | 参数 | 说明 | 类型 | 可选值 | 默认值 |
173
- |------|------|------|--------|--------|
174
- | name | 图标名称(支持 el-icon-xxx 自定义前缀) | string | — | '' |
175
- | size | 图标尺寸(数字单位 px,也可传入如 '2em' 的字符串) | string / number | — | '' |
176
- | color | 图标颜色(CSS color 值) | string | — | '' |
177
- | spin | 是否持续旋转 | boolean | — | false |
178
-
179
- ## Events
180
-
181
- | 事件名 | 说明 | 回调参数 |
182
- |--------|------|----------|
183
- | click | 点击图标时触发 | event |
184
-
185
- ## 静态方法
186
-
187
- | 方法名 | 说明 | 参数 |
188
- |--------|------|------|
189
- | ExIcon.registerPrefix(prefix) | 注册自定义字体图标前缀,注册后该前缀的图标不会自动添加 `ex-icon` 基础 class | prefix: string |
@@ -1,71 +0,0 @@
1
- ## ExLine - 折线图组件
2
-
3
- 基于 ECharts 封装的折线图组件。
4
-
5
- ## 基本用法
6
-
7
- ::: demo 折线图基础示例
8
- ```vue
9
- <template>
10
- <ExChart type="line" :chartData="chartData" style="height: 400px;" />
11
- </template>
12
-
13
- <script>
14
- export default {
15
- data() {
16
- return {
17
- chartData: [
18
- { name: '1月', value: 50 },
19
- { name: '2月', value: 65 },
20
- { name: '3月', value: 78 },
21
- { name: '4月', value: 82 },
22
- { name: '5月', value: 95 },
23
- { name: '6月', value: 88 }
24
- ]
25
- }
26
- }
27
- }
28
- </script>
29
- ```
30
- :::
31
-
32
- ## 面积区域
33
-
34
- ::: demo 显示面积区域
35
- ```vue
36
- <template>
37
- <ExChart type="line" :chartData="chartData" :isArea="true" style="height: 400px;" />
38
- </template>
39
-
40
- <script>
41
- export default {
42
- data() {
43
- return {
44
- chartData: [
45
- { name: '1月', value: 2450 },
46
- { name: '2月', value: 2800 },
47
- { name: '3月', value: 3200 },
48
- { name: '4月', value: 2950 },
49
- { name: '5月', value: 3500 },
50
- { name: '6月', value: 3800 },
51
- { name: '7月', value: 4200 },
52
- { name: '8月', value: 4500 }
53
- ]
54
- }
55
- }
56
- }
57
- </script>
58
- ```
59
- :::
60
-
61
- ## 属性说明
62
-
63
- | 属性 | 类型 | 默认值 | 说明 |
64
- |------|------|--------|------|
65
- | `chartData` | Array | [] | 图表数据 |
66
- | `theme` | String | '' | 主题名称 |
67
- | `size` | String | 'medium' | 尺寸 |
68
- | `isDark` | Boolean | false | 是否暗色模式 |
69
- | `isArea` | Boolean | false | 是否显示面积区域 |
70
- | `energyType` | String | '' | Y轴单位 |
71
- | `intervalvalue` | Number | 0 | 自定义间隔值 |
@@ -1,156 +0,0 @@
1
- ## ExMulti - 组合图组件
2
-
3
- 基于 ECharts 封装的组合图组件,支持多系列数据展示。
4
-
5
- ## 基本用法
6
-
7
- ::: demo 组合图基础示例
8
- ```vue
9
- <template>
10
- <ExChart type="multi" :chartData="chartData" style="height: 400px;" />
11
- </template>
12
-
13
- <script>
14
- export default {
15
- data() {
16
- return {
17
- chartData: [
18
- {
19
- label: "入户数",
20
- unit: "户",
21
- data: [
22
- { label: "01月", value: 980 },
23
- { label: "02月", value: 806 },
24
- { label: "03月", value: 930 },
25
- { label: "04月", value: 804 },
26
- { label: "05月", value: 750 },
27
- { label: "06月", value: 660 },
28
- { label: "07月", value: 780 },
29
- { label: "08月", value: 630 },
30
- { label: "09月", value: 806 },
31
- { label: "10月", value: 950 },
32
- { label: "11月", value: 810 },
33
- { label: "12月", value: 703 }
34
- ]
35
- },
36
- {
37
- label: "隐患数",
38
- unit: "个",
39
- data: [
40
- { label: "01月", value: 200 },
41
- { label: "02月", value: 120 },
42
- { label: "03月", value: 110 },
43
- { label: "04月", value: 109 },
44
- { label: "05月", value: 108 },
45
- { label: "06月", value: 150 },
46
- { label: "07月", value: 126 },
47
- { label: "08月", value: 130 },
48
- { label: "09月", value: 108 },
49
- { label: "10月", value: 109 },
50
- { label: "11月", value: 140 },
51
- { label: "12月", value: 106 }
52
- ]
53
- },
54
- {
55
- label: "整改数",
56
- unit: "个",
57
- data: [
58
- { label: "01月", value: 25 },
59
- { label: "02月", value: 19 },
60
- { label: "03月", value: 34 },
61
- { label: "04月", value: 12 },
62
- { label: "05月", value: 16 },
63
- { label: "06月", value: 20 },
64
- { label: "07月", value: 19 },
65
- { label: "08月", value: 18 },
66
- { label: "09月", value: 14 },
67
- { label: "10月", value: 12 },
68
- { label: "11月", value: 11 },
69
- { label: "12月", value: 16 }
70
- ]
71
- }
72
- ]
73
- }
74
- }
75
- }
76
- </script>
77
- ```
78
- :::
79
-
80
- ## 三系列组合
81
-
82
- ::: demo 三系列组合图示例
83
- ```vue
84
- <template>
85
- <ExChart type="multi" :chartData="chartData" style="height: 400px;" />
86
- </template>
87
-
88
- <script>
89
- export default {
90
- data() {
91
- return {
92
- chartData: [
93
- {
94
- label: "收入",
95
- data: [
96
- { label: "Q1", value: 1200 },
97
- { label: "Q2", value: 1500 },
98
- { label: "Q3", value: 1800 },
99
- { label: "Q4", value: 2200 }
100
- ]
101
- },
102
- {
103
- label: "支出",
104
- data: [
105
- { label: "Q1", value: 800 },
106
- { label: "Q2", value: 950 },
107
- { label: "Q3", value: 1100 },
108
- { label: "Q4", value: 1250 }
109
- ]
110
- },
111
- {
112
- label: "利润",
113
- data: [
114
- { label: "Q1", value: 400 },
115
- { label: "Q2", value: 550 },
116
- { label: "Q3", value: 700 },
117
- { label: "Q4", value: 950 }
118
- ]
119
- }
120
- ]
121
- }
122
- }
123
- }
124
- </script>
125
- ```
126
- :::
127
-
128
- ## 属性说明
129
-
130
- | 属性 | 类型 | 默认值 | 说明 |
131
- |------|------|--------|------|
132
- | `chartData` | Array | [] | 图表数据,支持多个系列 |
133
- | `theme` | String | '' | 主题名称 |
134
- | `size` | String | 'medium' | 尺寸 |
135
-
136
- ## 数据格式
137
-
138
- ```javascript
139
- [
140
- {
141
- label: "系列名称1",
142
- data: [
143
- { label: "分类1", value: 数值 },
144
- { label: "分类2", value: 数值 },
145
- // ...
146
- ]
147
- },
148
- {
149
- label: "系列名称2",
150
- data: [
151
- { label: "分类1", value: 数值 },
152
- // ...
153
- ]
154
- }
155
- ]
156
- ```
File without changes
@@ -1,70 +0,0 @@
1
- ## ExPie - 饼图组件
2
-
3
- 基于 ECharts 封装的饼图组件。
4
-
5
- ## 基本用法
6
-
7
- ::: demo 饼图基础示例
8
- ```vue
9
- <template>
10
- <ExChart type="pie" :chartData="chartData" style="height: 400px;" />
11
- </template>
12
-
13
- <script>
14
- export default {
15
- data() {
16
- return {
17
- chartData: [
18
- { name: '苹果', value: 35 },
19
- { name: '香蕉', value: 25 },
20
- { name: '橙子', value: 20 },
21
- { name: '葡萄', value: 15 },
22
- { name: '其他', value: 5 }
23
- ]
24
- }
25
- }
26
- }
27
- </script>
28
- ```
29
- :::
30
-
31
- ## 玫瑰图
32
-
33
- ::: demo 玫瑰图示例
34
- ```vue
35
- <template>
36
- <ExChart type="pie" :chartData="chartData" roseType="area" style="height: 400px;" />
37
- </template>
38
-
39
- <script>
40
- export default {
41
- data() {
42
- return {
43
- chartData: [
44
- { name: '手机端', value: 4520 },
45
- { name: 'PC端', value: 3280 },
46
- { name: '平板端', value: 1250 },
47
- { name: '小程序', value: 2150 },
48
- { name: 'H5页面', value: 1800 }
49
- ]
50
- }
51
- }
52
- }
53
- </script>
54
- ```
55
- :::
56
-
57
- ## 属性说明
58
-
59
- | 属性 | 类型 | 默认值 | 说明 |
60
- |------|------|--------|------|
61
- | `chartData` | Array | [] | 图表数据 |
62
- | `theme` | String | '' | 主题名称 |
63
- | `size` | String | 'medium' | 尺寸 |
64
- | `colors` | Array | [] | 自定义颜色数组 |
65
- | `unit` | String | '' | 数值单位 |
66
- | `showLegend` | Boolean | true | 是否显示图例 |
67
- | `showLabel` | Boolean | true | 是否显示标签 |
68
- | `chartMode` | String | 'dark' | 图表模式 |
69
- | `roseType` | String | '' | 玫瑰图类型 |
70
- | `totalLabel` | String | '总数' | 总数标签文本 |
@@ -1,210 +0,0 @@
1
- ## ExSelectTree 树形下拉选择
2
-
3
- 将 ElementUI 的 `el-tree` 与 `el-select` 结合,支持单选/多选、搜索过滤、树形层级展开等功能。
4
-
5
- ## 基础用法
6
-
7
- 最基础的单选用法:
8
-
9
- ::: demo 树形选择基础示例
10
- ```vue
11
- <template>
12
- <ex-select-tree
13
- v-model="value"
14
- :data="treeData"
15
- placeholder="请选择部门"
16
- />
17
- </template>
18
-
19
- <script>
20
- export default {
21
- data() {
22
- return {
23
- value: '',
24
- treeData: [
25
- {
26
- value: 1, label: '研发部',
27
- children: [
28
- { value: 11, label: '前端组' },
29
- { value: 12, label: '后端组' }
30
- ]
31
- },
32
- { value: 2, label: '市场部' },
33
- { value: 3, label: '运营部' }
34
- ]
35
- }
36
- }
37
- }
38
- </script>
39
- ```
40
- :::
41
-
42
- ## 多选模式
43
-
44
- 设置 `multiple` 属性开启多选,选中项以英文逗号分隔显示:
45
-
46
- ::: demo 树形选择多选示例
47
- ```vue
48
- <template>
49
- <ex-select-tree
50
- v-model="value"
51
- :data="treeData"
52
- multiple
53
- placeholder="请选择部门"
54
- />
55
- </template>
56
-
57
- <script>
58
- export default {
59
- data() {
60
- return {
61
- value: [],
62
- treeData: [
63
- { value: 1, label: '研发部', children: [
64
- { value: 11, label: '前端组' },
65
- { value: 12, label: '后端组' }
66
- ]},
67
- { value: 2, label: '市场部' },
68
- { value: 3, label: '运营部' }
69
- ]
70
- }
71
- }
72
- }
73
- </script>
74
- ```
75
- :::
76
-
77
- ## 自定义节点字段
78
-
79
- 通过 `props` 属性可自定义节点字段映射:
80
-
81
- ::: demo 树形选择自定义字段
82
- ```vue
83
- <template>
84
- <ex-select-tree
85
- v-model="value"
86
- :data="treeData"
87
- :props="{ value: 'id', label: 'name', children: 'sub' }"
88
- placeholder="请选择"
89
- />
90
- </template>
91
-
92
- <script>
93
- export default {
94
- data() {
95
- return {
96
- value: '',
97
- treeData: [
98
- { id: 1, name: '选项一', sub: [
99
- { id: 11, name: '子选项一' },
100
- { id: 12, name: '子选项二' }
101
- ]},
102
- { id: 2, name: '选项二' }
103
- ]
104
- }
105
- }
106
- }
107
- </script>
108
- ```
109
- :::
110
-
111
- ## 仅叶子节点可选
112
-
113
- 设置 `checkLeafOnly` 使多选模式下仅叶子节点会被纳入结果:
114
-
115
- ::: demo 仅叶子可选
116
- ```vue
117
- <template>
118
- <ex-select-tree
119
- v-model="value"
120
- :data="treeData"
121
- multiple
122
- check-leaf-only
123
- placeholder="请选择"
124
- />
125
- </template>
126
-
127
- <script>
128
- export default {
129
- data() {
130
- return {
131
- value: [],
132
- treeData: [
133
- { value: 1, label: '总部', children: [
134
- { value: 11, label: '上海' },
135
- { value: 12, label: '北京' }
136
- ]},
137
- { value: 2, label: '分部', children: [
138
- { value: 21, label: '广州' }
139
- ]}
140
- ]
141
- }
142
- }
143
- }
144
- </script>
145
- ```
146
- :::
147
-
148
- ## 可清空与禁用
149
-
150
- 支持 `clearable` 与 `disabled` 属性:
151
-
152
- ::: demo 可清空与禁用示例
153
- ```vue
154
- <template>
155
- <div>
156
- <ex-select-tree v-model="v1" :data="data" clearable placeholder="可清空" />
157
- <ex-select-tree v-model="v2" :data="data" disabled placeholder="已禁用" style="margin-left: 20px" />
158
- </div>
159
- </template>
160
-
161
- <script>
162
- export default {
163
- data() {
164
- return {
165
- v1: '',
166
- v2: '',
167
- data: [
168
- { value: 1, label: '选项一' },
169
- { value: 2, label: '选项二' }
170
- ]
171
- }
172
- }
173
- }
174
- </script>
175
- ```
176
- :::
177
-
178
- ## Attributes
179
-
180
- | 参数 | 说明 | 类型 | 可选值 | 默认值 |
181
- |------|------|------|--------|--------|
182
- | data | 树形数据 | array | — | [] |
183
- | props | 节点字段配置 | object | — | {value:'value', label:'label', children:'children', disabled:'disabled', isLeaf:'isLeaf'} |
184
- | multiple | 是否多选 | boolean | — | false |
185
- | clearable | 是否可清空 | boolean | — | false |
186
- | disabled | 是否禁用 | boolean | — | false |
187
- | filterable | 是否可搜索过滤 | boolean | — | true |
188
- | check-strictly | 是否父子节点不联动 | boolean | — | false |
189
- | check-leaf-only | 多选时是否仅返回叶子节点 | boolean | — | false |
190
- | include-half-checked | 多选时是否包含半选节点 | boolean | — | false |
191
- | default-expand-all | 是否默认展开所有节点 | boolean | — | false |
192
- | lazy | 是否懒加载子节点 | boolean | — | false |
193
- | load | 懒加载加载函数 | function | — | — |
194
- | placeholder | 占位符 | string | — | 请选择 |
195
- | size | 输入框尺寸 | string | medium/small/mini | — |
196
- | placement | 弹出位置 | string | top/top-start/top-end/bottom/bottom-start/bottom-end | bottom-start |
197
- | popover-width | 弹出层宽度(px) | number | — | — |
198
- | node-key | 节点唯一标识 | string | — | value |
199
- | highlight-current | 是否高亮当前选中节点 | boolean | — | true |
200
- | indent | 相邻级节点间的水平缩进(px) | number | — | — |
201
- | accordion | 是否每次只打开一个同级树节点 | boolean | — | false |
202
-
203
- ## Events
204
-
205
- | 事件名 | 说明 | 回调参数 |
206
- |--------|------|----------|
207
- | change | 值改变时触发 | (value, node) |
208
- | clear | 清空时触发 | — |
209
- | focus | 获得焦点 | — |
210
- | blur | 失去焦点 | — |