@fox-js/phone-skills 4.0.1-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.
- package/README.md +30 -0
- package/foxui/SKILL.md +442 -0
- package/foxui/references/fox-action-sheet/doc.md +74 -0
- package/foxui/references/fox-actionsheet-item/doc.md +499 -0
- package/foxui/references/fox-animate/doc.md +66 -0
- package/foxui/references/fox-audio/doc.md +76 -0
- package/foxui/references/fox-avatar/doc.md +70 -0
- package/foxui/references/fox-back-top/doc.md +69 -0
- package/foxui/references/fox-badge/doc.md +72 -0
- package/foxui/references/fox-barrage/doc.md +116 -0
- package/foxui/references/fox-button/doc.md +203 -0
- package/foxui/references/fox-calendar/doc.md +346 -0
- package/foxui/references/fox-calendar-item/doc.md +331 -0
- package/foxui/references/fox-cascader/doc.md +78 -0
- package/foxui/references/fox-cascader-item/doc.md +710 -0
- package/foxui/references/fox-cell/doc.md +74 -0
- package/foxui/references/fox-checkbox-item/doc.md +387 -0
- package/foxui/references/fox-circle-progress/doc.md +65 -0
- package/foxui/references/fox-collapse/doc.md +71 -0
- package/foxui/references/fox-count-down/doc.md +78 -0
- package/foxui/references/fox-count-up/doc.md +178 -0
- package/foxui/references/fox-date-item/doc.md +437 -0
- package/foxui/references/fox-date-picker/doc.md +438 -0
- package/foxui/references/fox-dialog/doc.md +242 -0
- package/foxui/references/fox-divider/doc.md +149 -0
- package/foxui/references/fox-domain-provider/doc.md +93 -0
- package/foxui/references/fox-drag/doc.md +64 -0
- package/foxui/references/fox-dropdown/doc.md +138 -0
- package/foxui/references/fox-elevator/doc.md +66 -0
- package/foxui/references/fox-ellipsis/doc.md +69 -0
- package/foxui/references/fox-empty/doc.md +67 -0
- package/foxui/references/fox-fixed-nav/doc.md +72 -0
- package/foxui/references/fox-floating-button/doc.md +142 -0
- package/foxui/references/fox-grid/doc.md +69 -0
- package/foxui/references/fox-group/doc.md +295 -0
- package/foxui/references/fox-icon/doc.md +65 -0
- package/foxui/references/fox-image/doc.md +75 -0
- package/foxui/references/fox-image-preview/doc.md +79 -0
- package/foxui/references/fox-indicator/doc.md +70 -0
- package/foxui/references/fox-infinite-loading/doc.md +74 -0
- package/foxui/references/fox-input-item/doc.md +210 -0
- package/foxui/references/fox-input-number/doc.md +199 -0
- package/foxui/references/fox-input-number-item/doc.md +213 -0
- package/foxui/references/fox-item/doc.md +207 -0
- package/foxui/references/fox-layout/doc.md +273 -0
- package/foxui/references/fox-link-item/doc.md +158 -0
- package/foxui/references/fox-list/doc.md +71 -0
- package/foxui/references/fox-mapping/doc.md +251 -0
- package/foxui/references/fox-menu/doc.md +425 -0
- package/foxui/references/fox-message-box/doc.md +200 -0
- package/foxui/references/fox-money-item/doc.md +174 -0
- package/foxui/references/fox-more-button/doc.md +208 -0
- package/foxui/references/fox-navbar/doc.md +75 -0
- package/foxui/references/fox-notice-bar/doc.md +71 -0
- package/foxui/references/fox-notify/doc.md +72 -0
- package/foxui/references/fox-number-keyboard/doc.md +77 -0
- package/foxui/references/fox-over-lay/doc.md +70 -0
- package/foxui/references/fox-page/doc.md +76 -0
- package/foxui/references/fox-pagination/doc.md +73 -0
- package/foxui/references/fox-picker/doc.md +668 -0
- package/foxui/references/fox-picker-item/doc.md +389 -0
- package/foxui/references/fox-popover/doc.md +70 -0
- package/foxui/references/fox-popover-dialog/doc.md +113 -0
- package/foxui/references/fox-popup/doc.md +88 -0
- package/foxui/references/fox-price/doc.md +67 -0
- package/foxui/references/fox-progress/doc.md +74 -0
- package/foxui/references/fox-pull-refresh/doc.md +77 -0
- package/foxui/references/fox-radio-item/doc.md +384 -0
- package/foxui/references/fox-range/doc.md +65 -0
- package/foxui/references/fox-rate/doc.md +141 -0
- package/foxui/references/fox-rate-item/doc.md +137 -0
- package/foxui/references/fox-rolling-provider/doc.md +87 -0
- package/foxui/references/fox-search-bar/doc.md +91 -0
- package/foxui/references/fox-short-password/doc.md +78 -0
- package/foxui/references/fox-side-nav-bar/doc.md +68 -0
- package/foxui/references/fox-signature/doc.md +202 -0
- package/foxui/references/fox-skeleton/doc.md +73 -0
- package/foxui/references/fox-steps/doc.md +162 -0
- package/foxui/references/fox-steps-bar/doc.md +610 -0
- package/foxui/references/fox-sticky/doc.md +68 -0
- package/foxui/references/fox-swipe/doc.md +176 -0
- package/foxui/references/fox-swiper/doc.md +254 -0
- package/foxui/references/fox-switch/doc.md +162 -0
- package/foxui/references/fox-switch-item/doc.md +190 -0
- package/foxui/references/fox-tabbar/doc.md +63 -0
- package/foxui/references/fox-table/doc.md +640 -0
- package/foxui/references/fox-tabs/doc.md +67 -0
- package/foxui/references/fox-tabs-bar/doc.md +533 -0
- package/foxui/references/fox-tag/doc.md +213 -0
- package/foxui/references/fox-text/doc.md +84 -0
- package/foxui/references/fox-textarea-item/doc.md +106 -0
- package/foxui/references/fox-toast/doc.md +149 -0
- package/foxui/references/fox-tour/doc.md +89 -0
- package/foxui/references/fox-trend-arrow/doc.md +72 -0
- package/foxui/references/fox-uploader/doc.md +96 -0
- package/foxui/references/fox-video/doc.md +245 -0
- package/foxui/references/fox-water-mark/doc.md +81 -0
- package/package.json +21 -0
|
@@ -0,0 +1,640 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: 江成
|
|
3
|
+
* @Date: 2026-04-27 00:37:28
|
|
4
|
+
* @LastEditors: 江成
|
|
5
|
+
* @LastEditTime: 2026-05-12 22:33:21
|
|
6
|
+
-->
|
|
7
|
+
---
|
|
8
|
+
title: Table 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 用于展示多条结构类似的数据,并具有一定的操作功能
|
|
12
|
+
tags: [foxui, fox-table, FoxTable]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Table 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
Table 是 foxui 中用于 **用于展示多条结构类似的数据,并具有一定的操作功能** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-table` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、适配 H5 与小程序多端、支持主题定制
|
|
24
|
+
- **适用场景**: 用于展示多条结构类似的数据,并具有一定的操作功能
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 用于展示多条结构类似的数据,并具有一定的操作功能 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `key` | 列的唯一标识 | String | |
|
|
37
|
+
| `title` | 表头标题 | String | |
|
|
38
|
+
| `stylehead` | 表头样式 | String | |
|
|
39
|
+
| `stylecolumn` | 列样式 | String | |
|
|
40
|
+
| `align` | 列的对齐方式,可选值left,center,right | String | left |
|
|
41
|
+
| `sorter` | 排序,可选值有 true,function, default, 其中 default表示点击之后可能会依赖接口, function可以返回具体的排序函数, default表示采用默认的排序算法 | Boolean、Function、String | - |
|
|
42
|
+
| `render` | 自定义渲染列数据,优先级高 | Functionrecord | - |
|
|
43
|
+
|
|
44
|
+
### 2.2 Events 事件
|
|
45
|
+
|
|
46
|
+
| 事件名 | 类型 | 说明 |
|
|
47
|
+
| :--- | :--- | :--- |
|
|
48
|
+
| `sorter` | 点击排序按钮触发 | item: 当前点击的表头的数据 |
|
|
49
|
+
|
|
50
|
+
### 2.3 Methods 方法
|
|
51
|
+
|
|
52
|
+
| 方法名 | 参数 | 说明 |
|
|
53
|
+
| :--- | :--- | :--- |
|
|
54
|
+
无
|
|
55
|
+
|
|
56
|
+
### 2.4 Slots 插槽
|
|
57
|
+
|
|
58
|
+
| 插槽名 | 说明 |
|
|
59
|
+
| :--- | :--- |
|
|
60
|
+
无
|
|
61
|
+
|
|
62
|
+
## 3. 例子 (Examples)
|
|
63
|
+
|
|
64
|
+
## 代码演示
|
|
65
|
+
|
|
66
|
+
### 基础使用
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
```html
|
|
70
|
+
<template>
|
|
71
|
+
<fox-table :columns="columns" :data="data"></fox-table>
|
|
72
|
+
</template>
|
|
73
|
+
<script lang="ts">
|
|
74
|
+
import { reactive, toRefs } from 'vue';
|
|
75
|
+
export default {
|
|
76
|
+
props: {},
|
|
77
|
+
setup() {
|
|
78
|
+
const state = reactive({
|
|
79
|
+
columns: [
|
|
80
|
+
{
|
|
81
|
+
title: '姓名',
|
|
82
|
+
key: 'name',
|
|
83
|
+
stylehead: 'font-size:20px;color:red;font-weight:bolder;',
|
|
84
|
+
stylecolumn: 'font-size:10px;color:blue'
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
title: '性别',
|
|
88
|
+
key: 'sex',
|
|
89
|
+
render: (record) => {
|
|
90
|
+
return h(
|
|
91
|
+
'span',
|
|
92
|
+
{
|
|
93
|
+
style: {
|
|
94
|
+
color: record.sex === '女' ? 'blue' : 'green'
|
|
95
|
+
}
|
|
96
|
+
},
|
|
97
|
+
record.sex
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
title: '学历',
|
|
103
|
+
key: 'record'
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
data: [
|
|
107
|
+
{
|
|
108
|
+
name: 'Tom',
|
|
109
|
+
sex: '男',
|
|
110
|
+
record: '小学'
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
name: 'Lucy',
|
|
114
|
+
sex: '女',
|
|
115
|
+
record: '本科'
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
name: 'Jack',
|
|
119
|
+
sex: '男',
|
|
120
|
+
record: '高中'
|
|
121
|
+
}
|
|
122
|
+
]
|
|
123
|
+
});
|
|
124
|
+
return {
|
|
125
|
+
...toRefs(state)
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
</script>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### 是否显示边框,文字对齐
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
```html
|
|
136
|
+
<template>
|
|
137
|
+
<fox-table :columns="columns" :data="data" :bordered="bordered"></fox-table>
|
|
138
|
+
</template>
|
|
139
|
+
<script lang="ts">
|
|
140
|
+
import { reactive, toRefs } from 'vue';
|
|
141
|
+
export default {
|
|
142
|
+
props: {},
|
|
143
|
+
setup() {
|
|
144
|
+
const state = reactive({
|
|
145
|
+
bordered: false,
|
|
146
|
+
columns: [
|
|
147
|
+
{
|
|
148
|
+
title: '姓名',
|
|
149
|
+
key: 'name',
|
|
150
|
+
align: 'center'
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
title: '性别',
|
|
154
|
+
key: 'sex'
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
title: '学历',
|
|
158
|
+
key: 'record'
|
|
159
|
+
}
|
|
160
|
+
],
|
|
161
|
+
data: [
|
|
162
|
+
{
|
|
163
|
+
name: 'Tom',
|
|
164
|
+
sex: '男',
|
|
165
|
+
record: '小学'
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
name: 'Lucy',
|
|
169
|
+
sex: '女',
|
|
170
|
+
record: '本科'
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
name: 'Jack',
|
|
174
|
+
sex: '男',
|
|
175
|
+
record: '高中'
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
});
|
|
179
|
+
return {
|
|
180
|
+
...toRefs(state)
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
</script>
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
### 显示总结栏
|
|
189
|
+
|
|
190
|
+
|
|
191
|
+
```html
|
|
192
|
+
<template>
|
|
193
|
+
<fox-table :columns="columns" :data="data" :summary="summary"></fox-table>
|
|
194
|
+
</template>
|
|
195
|
+
<script lang="ts">
|
|
196
|
+
import { reactive, toRefs } from 'vue';
|
|
197
|
+
export default {
|
|
198
|
+
props: {},
|
|
199
|
+
setup() {
|
|
200
|
+
const state = reactive({
|
|
201
|
+
columns: [
|
|
202
|
+
{
|
|
203
|
+
title: '姓名',
|
|
204
|
+
key: 'name'
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
title: '性别',
|
|
208
|
+
key: 'sex'
|
|
209
|
+
},
|
|
210
|
+
{
|
|
211
|
+
title: '学历',
|
|
212
|
+
key: 'record'
|
|
213
|
+
},
|
|
214
|
+
{
|
|
215
|
+
title: '年龄',
|
|
216
|
+
key: 'age'
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
title: '地址',
|
|
220
|
+
key: 'address'
|
|
221
|
+
}
|
|
222
|
+
],
|
|
223
|
+
data: [
|
|
224
|
+
{
|
|
225
|
+
name: 'Tom',
|
|
226
|
+
sex: '男',
|
|
227
|
+
record: '小学',
|
|
228
|
+
age: 13,
|
|
229
|
+
address: '北京'
|
|
230
|
+
},
|
|
231
|
+
{
|
|
232
|
+
name: 'Lucy',
|
|
233
|
+
sex: '女',
|
|
234
|
+
record: '本科',
|
|
235
|
+
age: 34,
|
|
236
|
+
address: '上海'
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
name: 'Jack',
|
|
240
|
+
sex: '男',
|
|
241
|
+
record: '高中',
|
|
242
|
+
age: 4,
|
|
243
|
+
address: '杭州'
|
|
244
|
+
}
|
|
245
|
+
],
|
|
246
|
+
summary: () => {
|
|
247
|
+
return {
|
|
248
|
+
value: '这是总结栏',
|
|
249
|
+
colspan: 5
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
});
|
|
253
|
+
return {
|
|
254
|
+
...toRefs(state)
|
|
255
|
+
};
|
|
256
|
+
}
|
|
257
|
+
};
|
|
258
|
+
</script>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
|
|
262
|
+
### 条纹、明暗交替
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
```html
|
|
266
|
+
<template>
|
|
267
|
+
<fox-table :columns="columns3" :data="data2" :striped="striped"></fox-table>
|
|
268
|
+
</template>
|
|
269
|
+
<script lang="ts">
|
|
270
|
+
import { reactive, toRefs } from 'vue';
|
|
271
|
+
export default {
|
|
272
|
+
props: {},
|
|
273
|
+
setup() {
|
|
274
|
+
const state = reactive({
|
|
275
|
+
striped: true,
|
|
276
|
+
columns3: [
|
|
277
|
+
{
|
|
278
|
+
title: '姓名',
|
|
279
|
+
key: 'name'
|
|
280
|
+
},
|
|
281
|
+
{
|
|
282
|
+
title: '性别',
|
|
283
|
+
key: 'sex'
|
|
284
|
+
},
|
|
285
|
+
{
|
|
286
|
+
title: '学历',
|
|
287
|
+
key: 'record'
|
|
288
|
+
},
|
|
289
|
+
{
|
|
290
|
+
title: '年龄',
|
|
291
|
+
key: 'age'
|
|
292
|
+
},
|
|
293
|
+
{
|
|
294
|
+
title: '地址',
|
|
295
|
+
key: 'address'
|
|
296
|
+
}
|
|
297
|
+
],
|
|
298
|
+
data2: [
|
|
299
|
+
{
|
|
300
|
+
name: 'Tom',
|
|
301
|
+
sex: '男',
|
|
302
|
+
record: '小学',
|
|
303
|
+
age: 13,
|
|
304
|
+
address: '北京'
|
|
305
|
+
},
|
|
306
|
+
{
|
|
307
|
+
name: 'Lucy',
|
|
308
|
+
sex: '女',
|
|
309
|
+
record: '本科',
|
|
310
|
+
age: 34,
|
|
311
|
+
address: '上海'
|
|
312
|
+
},
|
|
313
|
+
{
|
|
314
|
+
name: 'Jack',
|
|
315
|
+
sex: '男',
|
|
316
|
+
record: '高中',
|
|
317
|
+
age: 4,
|
|
318
|
+
address: '杭州'
|
|
319
|
+
}
|
|
320
|
+
]
|
|
321
|
+
});
|
|
322
|
+
return {
|
|
323
|
+
...toRefs(state)
|
|
324
|
+
};
|
|
325
|
+
}
|
|
326
|
+
};
|
|
327
|
+
</script>
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
|
|
331
|
+
### 无数据默认展示,支持自定义
|
|
332
|
+
|
|
333
|
+
|
|
334
|
+
```html
|
|
335
|
+
<template>
|
|
336
|
+
<fox-table :columns="columns" :data="data"></fox-table>
|
|
337
|
+
<fox-table :columns="columns3" :data="data3">
|
|
338
|
+
<template #nodata>
|
|
339
|
+
<div class="no-data"> 这里是自定义展示 </div>
|
|
340
|
+
</template>
|
|
341
|
+
</fox-table>
|
|
342
|
+
</template>
|
|
343
|
+
<script lang="ts">
|
|
344
|
+
import { reactive, toRefs } from 'vue';
|
|
345
|
+
export default {
|
|
346
|
+
setup() {
|
|
347
|
+
const state = reactive({
|
|
348
|
+
columns: [
|
|
349
|
+
{
|
|
350
|
+
title: '姓名',
|
|
351
|
+
key: 'name'
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
title: '性别',
|
|
355
|
+
key: 'sex'
|
|
356
|
+
},
|
|
357
|
+
{
|
|
358
|
+
title: '学历',
|
|
359
|
+
key: 'record'
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
title: '年龄',
|
|
363
|
+
key: 'age'
|
|
364
|
+
},
|
|
365
|
+
{
|
|
366
|
+
title: '地址',
|
|
367
|
+
key: 'address'
|
|
368
|
+
}
|
|
369
|
+
],
|
|
370
|
+
data: [],
|
|
371
|
+
columns3: [
|
|
372
|
+
{
|
|
373
|
+
title: '姓名',
|
|
374
|
+
key: 'name'
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
title: '性别',
|
|
378
|
+
key: 'sex'
|
|
379
|
+
},
|
|
380
|
+
{
|
|
381
|
+
title: '学历',
|
|
382
|
+
key: 'record'
|
|
383
|
+
},
|
|
384
|
+
{
|
|
385
|
+
title: '年龄',
|
|
386
|
+
key: 'age'
|
|
387
|
+
},
|
|
388
|
+
{
|
|
389
|
+
title: '地址',
|
|
390
|
+
key: 'address'
|
|
391
|
+
}
|
|
392
|
+
],
|
|
393
|
+
data3: []
|
|
394
|
+
});
|
|
395
|
+
return {
|
|
396
|
+
...toRefs(state)
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
};
|
|
400
|
+
</script>
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
|
|
404
|
+
### 自定义单元格
|
|
405
|
+
|
|
406
|
+
|
|
407
|
+
```html
|
|
408
|
+
<template>
|
|
409
|
+
<fox-table :columns="columns" :data="data"></fox-table>
|
|
410
|
+
</template>
|
|
411
|
+
<script lang="ts">
|
|
412
|
+
import { reactive, toRefs, h } from 'vue'
|
|
413
|
+
import { Button, Icon } from '@fox-js/foxui'
|
|
414
|
+
export default {
|
|
415
|
+
setup() {
|
|
416
|
+
const state = reactive({
|
|
417
|
+
columns: [
|
|
418
|
+
{
|
|
419
|
+
title: '姓名',
|
|
420
|
+
key: 'name',
|
|
421
|
+
align: 'center'
|
|
422
|
+
},
|
|
423
|
+
{
|
|
424
|
+
title: '性别',
|
|
425
|
+
key: 'sex'
|
|
426
|
+
},
|
|
427
|
+
{
|
|
428
|
+
title: '学历',
|
|
429
|
+
key: 'record'
|
|
430
|
+
},
|
|
431
|
+
{
|
|
432
|
+
title: '操作',
|
|
433
|
+
key: 'render'
|
|
434
|
+
}
|
|
435
|
+
],
|
|
436
|
+
data: [
|
|
437
|
+
{
|
|
438
|
+
name: 'Tom',
|
|
439
|
+
sex: '男',
|
|
440
|
+
record: '小学',
|
|
441
|
+
render: () => {
|
|
442
|
+
return h(
|
|
443
|
+
Button,
|
|
444
|
+
{
|
|
445
|
+
onClick: () => {
|
|
446
|
+
(Toast as any).text('hello');
|
|
447
|
+
},
|
|
448
|
+
size: 'small',
|
|
449
|
+
type: 'primary'
|
|
450
|
+
},
|
|
451
|
+
'Hello'
|
|
452
|
+
);
|
|
453
|
+
}
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
name: 'Lucy',
|
|
457
|
+
sex: '女',
|
|
458
|
+
record: '本科',
|
|
459
|
+
render: () => {
|
|
460
|
+
return h(Icon, { name: 'dongdong', size: '14px' });
|
|
461
|
+
}
|
|
462
|
+
},
|
|
463
|
+
{
|
|
464
|
+
name: 'Jack',
|
|
465
|
+
sex: '男',
|
|
466
|
+
record: '高中',
|
|
467
|
+
render: () => {
|
|
468
|
+
return h(
|
|
469
|
+
Button,
|
|
470
|
+
{
|
|
471
|
+
type: 'success',
|
|
472
|
+
size: 'small',
|
|
473
|
+
onClick: () => {
|
|
474
|
+
window.open('https://www.jd.com');
|
|
475
|
+
}
|
|
476
|
+
},
|
|
477
|
+
'跳转到京东'
|
|
478
|
+
);
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
]
|
|
482
|
+
});
|
|
483
|
+
return {
|
|
484
|
+
...toRefs(state)
|
|
485
|
+
};
|
|
486
|
+
}
|
|
487
|
+
};
|
|
488
|
+
</script>
|
|
489
|
+
```
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
### 支持异步渲染
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
```html
|
|
496
|
+
<template>
|
|
497
|
+
<h2>支持异步渲染(5s之后看效果)</h2>
|
|
498
|
+
<fox-table :columns="columns" :data="data"></fox-table>
|
|
499
|
+
</template>
|
|
500
|
+
<script lang="ts">
|
|
501
|
+
import { reactive, toRefs, onMounted } from 'vue';
|
|
502
|
+
export default {
|
|
503
|
+
props: {},
|
|
504
|
+
setup() {
|
|
505
|
+
const state = reactive({
|
|
506
|
+
columns: [
|
|
507
|
+
{
|
|
508
|
+
title: '姓名',
|
|
509
|
+
key: 'name'
|
|
510
|
+
},
|
|
511
|
+
{
|
|
512
|
+
title: '性别',
|
|
513
|
+
key: 'sex'
|
|
514
|
+
},
|
|
515
|
+
{
|
|
516
|
+
title: '学历',
|
|
517
|
+
key: 'record'
|
|
518
|
+
},
|
|
519
|
+
{
|
|
520
|
+
title: '年龄',
|
|
521
|
+
key: 'age'
|
|
522
|
+
},
|
|
523
|
+
{
|
|
524
|
+
title: '地址',
|
|
525
|
+
key: 'address'
|
|
526
|
+
}
|
|
527
|
+
],
|
|
528
|
+
data: [],
|
|
529
|
+
data1: [
|
|
530
|
+
{
|
|
531
|
+
address: '北京',
|
|
532
|
+
name: 'Tom',
|
|
533
|
+
sex: '男',
|
|
534
|
+
record: '小学',
|
|
535
|
+
age: 13
|
|
536
|
+
},
|
|
537
|
+
{
|
|
538
|
+
record: '本科',
|
|
539
|
+
name: 'Lucy',
|
|
540
|
+
sex: '女',
|
|
541
|
+
age: 34,
|
|
542
|
+
address: '上海'
|
|
543
|
+
},
|
|
544
|
+
{
|
|
545
|
+
name: 'Jack',
|
|
546
|
+
sex: '男',
|
|
547
|
+
record: '高中',
|
|
548
|
+
age: 4,
|
|
549
|
+
address: '杭州'
|
|
550
|
+
}
|
|
551
|
+
]
|
|
552
|
+
});
|
|
553
|
+
onMounted(() => {
|
|
554
|
+
setTimeout(() => {
|
|
555
|
+
state.data = state.data1.slice();
|
|
556
|
+
}, 5000);
|
|
557
|
+
});
|
|
558
|
+
return {
|
|
559
|
+
...toRefs(state)
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
</script>
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
|
|
567
|
+
### 支持排序
|
|
568
|
+
|
|
569
|
+
|
|
570
|
+
```html
|
|
571
|
+
<template>
|
|
572
|
+
<fox-table :columns="columns" :data="data" @sorter="handleSorter"></fox-table>
|
|
573
|
+
</template>
|
|
574
|
+
<script lang="ts">
|
|
575
|
+
import { reactive, toRefs } from 'vue'
|
|
576
|
+
import { Toast } from '@fox-js/foxui'
|
|
577
|
+
export default {
|
|
578
|
+
setup() {
|
|
579
|
+
const state = reactive({
|
|
580
|
+
columns: [
|
|
581
|
+
{
|
|
582
|
+
title: '姓名',
|
|
583
|
+
key: 'name',
|
|
584
|
+
align: 'center',
|
|
585
|
+
sorter: true
|
|
586
|
+
},
|
|
587
|
+
{
|
|
588
|
+
title: '性别',
|
|
589
|
+
key: 'sex'
|
|
590
|
+
},
|
|
591
|
+
{
|
|
592
|
+
title: '学历',
|
|
593
|
+
key: 'record'
|
|
594
|
+
},
|
|
595
|
+
{
|
|
596
|
+
title: '年龄',
|
|
597
|
+
key: 'age',
|
|
598
|
+
sorter: (row1: any, row2: any) => {
|
|
599
|
+
return row1.age - row2.age;
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
],
|
|
603
|
+
data: [
|
|
604
|
+
{
|
|
605
|
+
name: 'Tom',
|
|
606
|
+
sex: '男',
|
|
607
|
+
record: '小学',
|
|
608
|
+
age: 10
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
name: 'Lucy',
|
|
612
|
+
sex: '女',
|
|
613
|
+
record: '本科',
|
|
614
|
+
age: 30
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
name: 'Jack',
|
|
618
|
+
sex: '男',
|
|
619
|
+
record: '高中',
|
|
620
|
+
age: 4
|
|
621
|
+
}
|
|
622
|
+
]
|
|
623
|
+
});
|
|
624
|
+
|
|
625
|
+
const handleSorter = (item: TableColumnProps) => {
|
|
626
|
+
(Toast as any).text(`${JSON.stringify(item)}`);
|
|
627
|
+
};
|
|
628
|
+
|
|
629
|
+
return {
|
|
630
|
+
...toRefs(state),
|
|
631
|
+
handleSorter
|
|
632
|
+
};
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
</script>
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
## 4. 相关组件 (Related Components)
|
|
639
|
+
- **fox-js**: 与 Table 配合使用的相关组件
|
|
640
|
+
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: 江成
|
|
3
|
+
* @Date: 2026-04-27 00:37:28
|
|
4
|
+
* @LastEditors: 江成
|
|
5
|
+
* @LastEditTime: 2026-05-12 22:33:21
|
|
6
|
+
-->
|
|
7
|
+
---
|
|
8
|
+
title: Tabs 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 常用于平级区域大块内容的的收纳和展现,支持内嵌标签形式和渲染循环数据形式
|
|
12
|
+
tags: [foxui, fox-tabs, FoxTabs]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-tabpane","fox-icon"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Tabs 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
Tabs 是 foxui 中用于 **常用于平级区域大块内容的的收纳和展现,支持内嵌标签形式和渲染循环数据形式** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-tabs` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、支持 v-model 双向绑定、支持禁用/只读状态、适配 H5 与小程序多端、支持插槽扩展自定义内容
|
|
24
|
+
- **适用场景**: 常用于平级区域大块内容的的收纳和展现,支持内嵌标签形式和渲染循环数据形式
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 常用于平级区域大块内容的的收纳和展现,支持内嵌标签形式和渲染循环数据形式 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `title` | 标题 | string |
|
|
37
|
+
| `pane-key` | 标签 Key , 匹配的标识符 | string | 默认索引0,1,2... |
|
|
38
|
+
| `disabled` | 是否禁用标签 | boolean | false |
|
|
39
|
+
|
|
40
|
+
### 2.2 Events 事件
|
|
41
|
+
|
|
42
|
+
| 事件名 | 类型 | 说明 |
|
|
43
|
+
| :--- | :--- | :--- |
|
|
44
|
+
| `click` | 点击标签时触发 | title,paneKey,disabled |
|
|
45
|
+
| `change` | 当前激活的标签改变时触发 | title,paneKey,disabled |
|
|
46
|
+
|
|
47
|
+
### 2.3 Methods 方法
|
|
48
|
+
|
|
49
|
+
| 方法名 | 参数 | 说明 |
|
|
50
|
+
| :--- | :--- | :--- |
|
|
51
|
+
无
|
|
52
|
+
|
|
53
|
+
### 2.4 Slots 插槽
|
|
54
|
+
|
|
55
|
+
| 插槽名 | 说明 |
|
|
56
|
+
| :--- | :--- |
|
|
57
|
+
| `default` | 自定义内容 |
|
|
58
|
+
|
|
59
|
+
## 3. 例子 (Examples)
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
## 4. 相关组件 (Related Components)
|
|
64
|
+
- **fox-js**: 与 Tabs 配合使用的相关组件
|
|
65
|
+
- **fox-tabpane**: 与 Tabs 配合使用的相关组件
|
|
66
|
+
- **fox-icon**: 与 Tabs 配合使用的相关组件
|
|
67
|
+
|