@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,389 @@
|
|
|
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: PickerItem 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 选择框组件
|
|
12
|
+
tags: [foxui, fox-picker-item, FoxPickerItem]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-group","fox-switch-item"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# PickerItem 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
PickerItem 是 foxui 中用于 **选择框组件** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-picker-item` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、内置必填校验标识、支持 v-model 双向绑定、支持标签位置自定义、支持占位符提示、支持禁用/只读状态、内置多级提示信息、支持插槽扩展自定义内容、支持主题定制
|
|
24
|
+
- **适用场景**: 选择框组件
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 选择框组件 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `v-model` | 输入值,双向绑定 | String | - |
|
|
37
|
+
| `placeholder` | 为空时占位符 | String | - |
|
|
38
|
+
| `clearable` | 展示清除icon | Boolean | true |
|
|
39
|
+
| `text-align` | 文本位置,可选值left,center,right | String | left |
|
|
40
|
+
| `label` | 标签 | String | - |
|
|
41
|
+
| `label-width` | 标签宽度 | String | - |
|
|
42
|
+
| `label-position` | 标签位置可选值left,right,top | String | - |
|
|
43
|
+
| `is-required` | 左侧号是否展示 | Boolean | false |
|
|
44
|
+
| `disabled` | 是否禁用 | Boolean | false |
|
|
45
|
+
| `readonly` | 是否只读 | Boolean | false |
|
|
46
|
+
| `error-tip` | 错误提示 | String | - |
|
|
47
|
+
| `error-icon` | 错误提示图标 | String | - |
|
|
48
|
+
| `warn-tip` | 警告提示 | String | - |
|
|
49
|
+
| `warn-icon` | 警告提示图标 | String | - |
|
|
50
|
+
| `info-tip` | 提示 | String | - |
|
|
51
|
+
| `info-icon` | 提示图标 | String | - |
|
|
52
|
+
| `title` | 设置标题 | String | - |
|
|
53
|
+
| `cancel-text` | 取消按钮文案 | String | 取消 |
|
|
54
|
+
| `confirm-text` | 确定按钮文案 | String | 确定 |
|
|
55
|
+
| `source` | 数据源 | string / array/ function | — |
|
|
56
|
+
| `source-filter` | 数据源过滤器 | function | — |
|
|
57
|
+
| `param` | 请求参数配置数据源api使用 | record<string,any> | — |
|
|
58
|
+
| `valueType` | 值的类型text:item.text,value:item.value,item:item | String | "value" |
|
|
59
|
+
| `text-key` | 指定异构数据源的text key | String | "text" |
|
|
60
|
+
| `value-key` | 指定异构数据源的value key | String | "value" |
|
|
61
|
+
| `children-key` | 指定异构数据源的children key | String | "children" |
|
|
62
|
+
| `teleport` | 指定挂载节点 | String | "body" |
|
|
63
|
+
| `close-on-click-overlay` | 点击蒙层是否关闭对话框 | Boolean | false |
|
|
64
|
+
| `lock-scroll` | 背景是否锁定 | Boolean | false |
|
|
65
|
+
| `three-dimensional` | 是否开启3D效果 | Boolean | true |
|
|
66
|
+
| `swipe-duration` | 惯性滚动时长 | Number、String | 1000 |
|
|
67
|
+
| `visible-item-count` | 可见item数量必须为奇数 | Number、String | 7 |
|
|
68
|
+
| `separator` | 分割符 | String | |
|
|
69
|
+
|
|
70
|
+
### 2.2 Events 事件
|
|
71
|
+
|
|
72
|
+
| 事件名 | 类型 | 说明 |
|
|
73
|
+
| :--- | :--- | :--- |
|
|
74
|
+
| `change` | 输入内容时触发 | val, item |
|
|
75
|
+
| `focus` | 聚焦时触发 | val |
|
|
76
|
+
| `blur` | 失焦时触发 | val |
|
|
77
|
+
| `clear` | 点击清空时触发 | val |
|
|
78
|
+
|
|
79
|
+
### 2.3 Methods 方法
|
|
80
|
+
|
|
81
|
+
| 方法名 | 参数 | 说明 |
|
|
82
|
+
| :--- | :--- | :--- |
|
|
83
|
+
无
|
|
84
|
+
|
|
85
|
+
### 2.4 Slots 插槽
|
|
86
|
+
|
|
87
|
+
| 插槽名 | 说明 |
|
|
88
|
+
| :--- | :--- |
|
|
89
|
+
| `default` | label内容 |
|
|
90
|
+
| `prepend` | 左侧自定义内容 |
|
|
91
|
+
| `append` | 右侧自定义内容 |
|
|
92
|
+
|
|
93
|
+
## 3. 例子 (Examples)
|
|
94
|
+
|
|
95
|
+
## 代码演示
|
|
96
|
+
### 基础用法
|
|
97
|
+
常用属性与事件
|
|
98
|
+
```html
|
|
99
|
+
<fox-picker-item v-model="val" :source="m_str_items" @change="onChange" @focus="onFocus" @blur="onBlur">选择框</fox-picker-item>
|
|
100
|
+
<fox-picker-item v-model="val2" :source="m_items" :is-required="m_required">必输</fox-picker-item>
|
|
101
|
+
<fox-picker-item v-model="val3" :source="m_str_multi_items" :readonly="m_readonly">只读</fox-picker-item>
|
|
102
|
+
<fox-picker-item v-model="val4" :source="m_str_multi_items" :disabled="m_disabled">禁用</fox-picker-item>
|
|
103
|
+
<fox-picker-item v-model="val14" :source="m_str_multi_items" :three-dimensional="false">平铺样式</fox-picker-item>
|
|
104
|
+
```
|
|
105
|
+
```javascript
|
|
106
|
+
export default createDemo({
|
|
107
|
+
setup() {
|
|
108
|
+
// 数据
|
|
109
|
+
const data = reactive({
|
|
110
|
+
m_str_items: ['南京', '无锡', '海北藏族自治区', '北京', '连云港', '浙江省', '江苏省'],
|
|
111
|
+
m_items: [
|
|
112
|
+
{ text: '南京', value: '01' },
|
|
113
|
+
{ text: '无锡', value: '02' },
|
|
114
|
+
{ text: '海北藏族自治区', value: '03' },
|
|
115
|
+
{ text: '北京', value: '04' },
|
|
116
|
+
{ text: '连云港', value: '05' },
|
|
117
|
+
{ text: '浙江省', value: '06' },
|
|
118
|
+
{ text: '江苏省', value: '07' }
|
|
119
|
+
],
|
|
120
|
+
m_str_multi_items: [
|
|
121
|
+
['周一', '周二', '周三', '周四', '周五'],
|
|
122
|
+
['上午', '下午', '晚上']
|
|
123
|
+
],
|
|
124
|
+
val: '浙江省',
|
|
125
|
+
val2: '',
|
|
126
|
+
val3: ['周三', '晚上'],
|
|
127
|
+
val4: ['周五', '下午'],
|
|
128
|
+
val14: null,
|
|
129
|
+
m_disabled: true,
|
|
130
|
+
m_readonly: true,
|
|
131
|
+
m_required: true,
|
|
132
|
+
})
|
|
133
|
+
// 方法
|
|
134
|
+
const methods = {
|
|
135
|
+
onChange: (value: string | number, event: Event) => {
|
|
136
|
+
console.log('change: ', value, event)
|
|
137
|
+
},
|
|
138
|
+
onFocus: (value: string | number, event: Event) => {
|
|
139
|
+
console.log('focus:', value, event)
|
|
140
|
+
},
|
|
141
|
+
onBlur: (value: string | number, event: Event) => {
|
|
142
|
+
console.log('blur:', value, event)
|
|
143
|
+
},
|
|
144
|
+
onClear: (value: string | number) => {
|
|
145
|
+
console.log('clear:', value)
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return {
|
|
149
|
+
...toRefs(data),
|
|
150
|
+
...methods
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
});
|
|
154
|
+
```
|
|
155
|
+
### 多列样式
|
|
156
|
+
根据不同的数据源格式,select组件分为单列、多列和级联
|
|
157
|
+
```html
|
|
158
|
+
<fox-picker-item v-model="val5" :source="m_items">单列</fox-picker-item>
|
|
159
|
+
<fox-picker-item v-model="val6" :source="m_func">多列</fox-picker-item>
|
|
160
|
+
<fox-picker-item v-model="val7" :source="m_address">级联</fox-picker-item>
|
|
161
|
+
```
|
|
162
|
+
```javascript
|
|
163
|
+
export default createDemo({
|
|
164
|
+
setup() {
|
|
165
|
+
// 数据
|
|
166
|
+
let m_multi_items = [
|
|
167
|
+
[
|
|
168
|
+
{ text: '周一', value: '一' },
|
|
169
|
+
{ text: '周二', value: '二' },
|
|
170
|
+
{ text: '周三', value: '三' },
|
|
171
|
+
{ text: '周四', value: '四' },
|
|
172
|
+
{ text: '周五', value: '五' }
|
|
173
|
+
],
|
|
174
|
+
[
|
|
175
|
+
{ text: '上午', value: '上' },
|
|
176
|
+
{ text: '下午', value: '下' },
|
|
177
|
+
{ text: '晚上', value: '晚' }
|
|
178
|
+
]
|
|
179
|
+
]
|
|
180
|
+
// 数据
|
|
181
|
+
const data = reactive({
|
|
182
|
+
m_items: [
|
|
183
|
+
{ text: '南京', value: '01' },
|
|
184
|
+
{ text: '无锡', value: '02' },
|
|
185
|
+
{ text: '海北藏族自治区', value: '03' },
|
|
186
|
+
{ text: '北京', value: '04' },
|
|
187
|
+
{ text: '连云港', value: '05' },
|
|
188
|
+
{ text: '浙江省', value: '06' },
|
|
189
|
+
{ text: '江苏省', value: '07' }
|
|
190
|
+
],
|
|
191
|
+
m_func: (): Promise<unknown> => {
|
|
192
|
+
return new Promise(resolve => {
|
|
193
|
+
resolve(m_multi_items)
|
|
194
|
+
})
|
|
195
|
+
},
|
|
196
|
+
val5: '03',
|
|
197
|
+
val6: ['周五', '晚上'],
|
|
198
|
+
val7: [],
|
|
199
|
+
})
|
|
200
|
+
return {
|
|
201
|
+
...toRefs(data),
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
```
|
|
206
|
+
### 返回类型
|
|
207
|
+
通过属性value-type设置v-model的数据类型,分别为text,value(默认)和item
|
|
208
|
+
```html
|
|
209
|
+
<fox-picker-item v-model="val8" :source="m_items">value</fox-picker-item>
|
|
210
|
+
<fox-picker-item v-model="val9" :source="m_func" value-type="text">text</fox-picker-item>
|
|
211
|
+
<fox-picker-item v-model="val10" :source="m_address" value-type="item">item</fox-picker-item>
|
|
212
|
+
```
|
|
213
|
+
```javascript
|
|
214
|
+
export default createDemo({
|
|
215
|
+
setup() {
|
|
216
|
+
// 数据
|
|
217
|
+
let m_multi_items = [
|
|
218
|
+
[
|
|
219
|
+
{ text: '周一', value: '一' },
|
|
220
|
+
{ text: '周二', value: '二' },
|
|
221
|
+
{ text: '周三', value: '三' },
|
|
222
|
+
{ text: '周四', value: '四' },
|
|
223
|
+
{ text: '周五', value: '五' }
|
|
224
|
+
],
|
|
225
|
+
[
|
|
226
|
+
{ text: '上午', value: '上' },
|
|
227
|
+
{ text: '下午', value: '下' },
|
|
228
|
+
{ text: '晚上', value: '晚' }
|
|
229
|
+
]
|
|
230
|
+
]
|
|
231
|
+
// 数据
|
|
232
|
+
const data = reactive({
|
|
233
|
+
m_items: [
|
|
234
|
+
{ text: '南京', value: '01' },
|
|
235
|
+
{ text: '无锡', value: '02' },
|
|
236
|
+
{ text: '海北藏族自治区', value: '03' },
|
|
237
|
+
{ text: '北京', value: '04' },
|
|
238
|
+
{ text: '连云港', value: '05' },
|
|
239
|
+
{ text: '浙江省', value: '06' },
|
|
240
|
+
{ text: '江苏省', value: '07' }
|
|
241
|
+
],
|
|
242
|
+
m_func: (): Promise<unknown> => {
|
|
243
|
+
return new Promise(resolve => {
|
|
244
|
+
resolve(m_multi_items)
|
|
245
|
+
})
|
|
246
|
+
},
|
|
247
|
+
val8: '医生',
|
|
248
|
+
val9: '',
|
|
249
|
+
val10: [],
|
|
250
|
+
})
|
|
251
|
+
return {
|
|
252
|
+
...toRefs(data),
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
```
|
|
257
|
+
### 数据源
|
|
258
|
+
|
|
259
|
+
选择组件的数据源支持`数组`, `函数`, `服务API`和`异构`(需要配合`text-key`和`value-key`两个属性),另外可以通过`source-filter`属性对数据源进行最终的过滤(一般配合`服务API数据源`使用)
|
|
260
|
+
|
|
261
|
+
```vue
|
|
262
|
+
<!--
|
|
263
|
+
* @Author: 江成
|
|
264
|
+
* @Date: 2022-11-28 19:07:56
|
|
265
|
+
-->
|
|
266
|
+
<script lang="ts" setup>
|
|
267
|
+
import { ref, watch, computed } from 'vue'
|
|
268
|
+
import { setAPI } from '@/api'
|
|
269
|
+
|
|
270
|
+
// 注册api代理函数,模拟api请求
|
|
271
|
+
setAPI('select', (path: string, params: any) => {
|
|
272
|
+
console.info(`处理select获取数据请求, path:${path} params:`, params)
|
|
273
|
+
if (path === 'provide') {
|
|
274
|
+
return new Promise<any>(resolve => {
|
|
275
|
+
setTimeout(() => {
|
|
276
|
+
resolve([
|
|
277
|
+
{ text: '广东省', value: 'a' },
|
|
278
|
+
{ text: '江苏省', value: 'b' },
|
|
279
|
+
{ text: '浙江省', value: 'c' },
|
|
280
|
+
{ text: '福建省', value: 'd' },
|
|
281
|
+
{ text: '四川省', value: 'e' },
|
|
282
|
+
{ text: '云南省', value: 'f' }
|
|
283
|
+
])
|
|
284
|
+
}, 500)
|
|
285
|
+
})
|
|
286
|
+
} else {
|
|
287
|
+
return new Promise<any>(resolve => {
|
|
288
|
+
setTimeout(() => {
|
|
289
|
+
resolve([
|
|
290
|
+
{ text: '南京', value: '01' },
|
|
291
|
+
{ text: '无锡', value: '02' },
|
|
292
|
+
{ text: '苏州', value: '03' },
|
|
293
|
+
{ text: '无锡', value: '04' },
|
|
294
|
+
{ text: '台州', value: '05' },
|
|
295
|
+
{ text: '杭州', value: '06' },
|
|
296
|
+
{ text: '宁波', value: '07' }
|
|
297
|
+
])
|
|
298
|
+
}, 500)
|
|
299
|
+
})
|
|
300
|
+
}
|
|
301
|
+
})
|
|
302
|
+
|
|
303
|
+
// 数组数据源
|
|
304
|
+
const sourceForArray = ref([
|
|
305
|
+
{ text: '南京', value: '01' },
|
|
306
|
+
{ text: '无锡', value: '02' },
|
|
307
|
+
{ text: '海北藏族自治区', value: '03' },
|
|
308
|
+
{ text: '北京', value: '04' },
|
|
309
|
+
{ text: '连云港', value: '05' },
|
|
310
|
+
{ text: '浙江省', value: '06' },
|
|
311
|
+
{ text: '江苏省', value: '07' }
|
|
312
|
+
])
|
|
313
|
+
// 函数数据源
|
|
314
|
+
const sourceForFunction = async (params: any) => {
|
|
315
|
+
console.info('函数处理数据源, params:', params)
|
|
316
|
+
return sourceForArray.value
|
|
317
|
+
}
|
|
318
|
+
// 异构数据源
|
|
319
|
+
const sourceForOtherType = ref([
|
|
320
|
+
{
|
|
321
|
+
id: '001',
|
|
322
|
+
name: '刘德华'
|
|
323
|
+
},
|
|
324
|
+
{
|
|
325
|
+
id: '002',
|
|
326
|
+
name: '黎明'
|
|
327
|
+
},
|
|
328
|
+
{
|
|
329
|
+
id: '003',
|
|
330
|
+
name: '张学友'
|
|
331
|
+
},
|
|
332
|
+
{
|
|
333
|
+
id: '004',
|
|
334
|
+
name: '郭富城'
|
|
335
|
+
}
|
|
336
|
+
])
|
|
337
|
+
|
|
338
|
+
// model value
|
|
339
|
+
const val = ref('01')
|
|
340
|
+
const val2 = ref('02')
|
|
341
|
+
const val3 = ref('05')
|
|
342
|
+
const val4 = ref({
|
|
343
|
+
id: '002',
|
|
344
|
+
name: '黎明'
|
|
345
|
+
})
|
|
346
|
+
|
|
347
|
+
watch(val4, newVal => {
|
|
348
|
+
console.info('------ val4 change', newVal)
|
|
349
|
+
})
|
|
350
|
+
|
|
351
|
+
// 省份value
|
|
352
|
+
const val5 = ref('')
|
|
353
|
+
// source filter
|
|
354
|
+
const sourceFilter = (item: Record<string, any>) => {
|
|
355
|
+
if (isCoastalRegion.value) {
|
|
356
|
+
return ['a', 'b', 'c', 'd'].includes(item.value)
|
|
357
|
+
} else {
|
|
358
|
+
return ['e', 'f'].includes(item.value)
|
|
359
|
+
}
|
|
360
|
+
}
|
|
361
|
+
// source filter
|
|
362
|
+
// 是否沿海省份
|
|
363
|
+
const isCoastalRegion = ref(true)
|
|
364
|
+
// coastal region text
|
|
365
|
+
const coastalRegionText = computed(() => {
|
|
366
|
+
return isCoastalRegion.value ? '沿海省份' : '内地省份'
|
|
367
|
+
})
|
|
368
|
+
</script>
|
|
369
|
+
|
|
370
|
+
<template>
|
|
371
|
+
<fox-group column="3">
|
|
372
|
+
<fox-picker-item v-model="val" :source="sourceForArray">数组</fox-picker-item>
|
|
373
|
+
<fox-picker-item v-model="val2" :source="sourceForFunction">函数</fox-picker-item>
|
|
374
|
+
<fox-picker-item v-model="val3" source="city">API</fox-picker-item>
|
|
375
|
+
<fox-picker-item v-model="val4" :source="sourceForOtherType" value-type="item" text-key="name" value-key="id"
|
|
376
|
+
>异构
|
|
377
|
+
</fox-picker-item>
|
|
378
|
+
<fox-picker-item v-model="val5" source="provide" :source-filter="sourceFilter">省份</fox-picker-item>
|
|
379
|
+
<fox-switch-item v-model="isCoastalRegion">{{ coastalRegionText }}</fox-switch-item>
|
|
380
|
+
</fox-group>
|
|
381
|
+
</template>
|
|
382
|
+
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
## 4. 相关组件 (Related Components)
|
|
386
|
+
- **fox-js**: 与 PickerItem 配合使用的相关组件
|
|
387
|
+
- **fox-group**: 与 PickerItem 配合使用的相关组件
|
|
388
|
+
- **fox-switch-item**: 与 PickerItem 配合使用的相关组件
|
|
389
|
+
|
|
@@ -0,0 +1,70 @@
|
|
|
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: Popover 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 气泡弹出框
|
|
12
|
+
tags: [foxui, fox-popover, FoxPopover]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-button","fox-icon"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Popover 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
Popover 是 foxui 中用于 **气泡弹出框** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-popover` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、支持禁用/只读状态、适配 H5 与小程序多端、支持插槽扩展自定义内容、支持主题定制
|
|
24
|
+
- **适用场景**: 气泡弹出框
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 气泡弹出框 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `list` | 选项列表 | List | |
|
|
37
|
+
| `visible` | 是否展示气泡弹出层 | boolean | false |
|
|
38
|
+
| `theme` | 主题风格,可选值为 dark | string | light |
|
|
39
|
+
| `location` | 弹出位置,可选值为 top,left,right | string | bottom |
|
|
40
|
+
|
|
41
|
+
### 2.2 Events 事件
|
|
42
|
+
|
|
43
|
+
| 事件名 | 类型 | 说明 |
|
|
44
|
+
| :--- | :--- | :--- |
|
|
45
|
+
| `choose` | 点击选项时触发 |
|
|
46
|
+
| `open` | 打开菜单时触发 |
|
|
47
|
+
| `close` | 关闭菜单时触发 |
|
|
48
|
+
|
|
49
|
+
### 2.3 Methods 方法
|
|
50
|
+
|
|
51
|
+
| 方法名 | 参数 | 说明 |
|
|
52
|
+
| :--- | :--- | :--- |
|
|
53
|
+
无
|
|
54
|
+
|
|
55
|
+
### 2.4 Slots 插槽
|
|
56
|
+
|
|
57
|
+
| 插槽名 | 说明 |
|
|
58
|
+
| :--- | :--- |
|
|
59
|
+
| `content` | 自定义气泡组件菜单内容 |
|
|
60
|
+
| `reference` | 触发 Popover 显示的元素内容 |
|
|
61
|
+
|
|
62
|
+
## 3. 例子 (Examples)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
## 4. 相关组件 (Related Components)
|
|
67
|
+
- **fox-js**: 与 Popover 配合使用的相关组件
|
|
68
|
+
- **fox-button**: 与 Popover 配合使用的相关组件
|
|
69
|
+
- **fox-icon**: 与 Popover 配合使用的相关组件
|
|
70
|
+
|
|
@@ -0,0 +1,113 @@
|
|
|
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: PopoverDialog 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: Popover弹出框
|
|
12
|
+
tags: [foxui, fox-popover-dialog, FoxPopoverDialog]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# PopoverDialog 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
PopoverDialog 是 foxui 中用于 **Popover弹出框** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-popover-dialog` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、适配 H5 与小程序多端、支持插槽扩展自定义内容、支持主题定制
|
|
24
|
+
- **适用场景**: Popover弹出框
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 Popover弹出框 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `visible` | 是否展示气泡弹出层 | boolean | false |
|
|
37
|
+
| `reference` | 相关组件 | any |
|
|
38
|
+
| `referenceInset` | 相关组件inset | any |
|
|
39
|
+
| `width` | 弹出宽度 | string |
|
|
40
|
+
| `offset` | 弹框偏移量 | string |
|
|
41
|
+
| `placement` | 弹出位置,可选值为 top,top-start, top-end,left,left-start,left-end,right,right-start,right-end,bottom,bottom-start,bottom-end | string | bottom-start |
|
|
42
|
+
| `auto-fit` | 是否自定调整位置 | boolean | true |
|
|
43
|
+
| `title` | 标题 | string |
|
|
44
|
+
| `effect` | 主题风格,可选值为 dark | string | light |
|
|
45
|
+
| `show-arrow` | 是否显示arrow | boolean |
|
|
46
|
+
| `arrow-size` | 箭头size | number | 14 |
|
|
47
|
+
| `arrow-offset` | 箭头offset | number | 20 |
|
|
48
|
+
| `show-overlay` | 是否显示overlay | boolean | false |
|
|
49
|
+
| `close-on-click` | 点击关闭 | boolean | true |
|
|
50
|
+
| `z-index` | z-index | string |
|
|
51
|
+
| `custom-class` | 自定义class | string |
|
|
52
|
+
| `custom-style` | 自定义style | Object |
|
|
53
|
+
| `leave-hide` | 鼠标离开隐藏 | boolean |
|
|
54
|
+
|
|
55
|
+
### 2.2 Events 事件
|
|
56
|
+
|
|
57
|
+
| 事件名 | 类型 | 说明 |
|
|
58
|
+
| :--- | :--- | :--- |
|
|
59
|
+
无
|
|
60
|
+
|
|
61
|
+
### 2.3 Methods 方法
|
|
62
|
+
|
|
63
|
+
| 方法名 | 参数 | 说明 |
|
|
64
|
+
| :--- | :--- | :--- |
|
|
65
|
+
无
|
|
66
|
+
|
|
67
|
+
### 2.4 Slots 插槽
|
|
68
|
+
|
|
69
|
+
| 插槽名 | 说明 |
|
|
70
|
+
| :--- | :--- |
|
|
71
|
+
| `title` | 自定义气泡组件标题内容 |
|
|
72
|
+
| `default` | 自定义气泡组件内容 |
|
|
73
|
+
|
|
74
|
+
## 3. 例子 (Examples)
|
|
75
|
+
|
|
76
|
+
## 代码演示
|
|
77
|
+
|
|
78
|
+
### 主题风格
|
|
79
|
+
|
|
80
|
+
Popover 支持明朗和暗黑两种风格,默认为明朗风格,将 effect 属性设置为 dark 可切换为暗黑风格。
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
:::demo
|
|
84
|
+
|
|
85
|
+
popoverdialog/demo_effect
|
|
86
|
+
|
|
87
|
+
:::
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
### 位置自定义
|
|
91
|
+
|
|
92
|
+
支持 top, top-start, top-end, bottom, bottom-start, bottom-end, left, left-start, left-end , right, right-start, right-end 12种弹出位置,默认值为 bottom。
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
:::demo
|
|
96
|
+
|
|
97
|
+
popoverdialog/demo_placement
|
|
98
|
+
|
|
99
|
+
:::
|
|
100
|
+
|
|
101
|
+
### 自定义内容
|
|
102
|
+
|
|
103
|
+
可以通过插槽自定义内容
|
|
104
|
+
|
|
105
|
+
:::demo
|
|
106
|
+
|
|
107
|
+
popoverdialog/demo_custom
|
|
108
|
+
|
|
109
|
+
:::
|
|
110
|
+
|
|
111
|
+
## 4. 相关组件 (Related Components)
|
|
112
|
+
- **fox-js**: 与 PopoverDialog 配合使用的相关组件
|
|
113
|
+
|
|
@@ -0,0 +1,88 @@
|
|
|
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: Popup 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 弹出层容器,用于展示弹窗、信息提示等内容,支持多个弹出层叠加展示
|
|
12
|
+
tags: [foxui, fox-popup, FoxPopup]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-cell"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Popup 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
Popup 是 foxui 中用于 **弹出层容器,用于展示弹窗、信息提示等内容,支持多个弹出层叠加展示** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-popup` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、支持 v-model 双向绑定、支持插槽扩展自定义内容、支持主题定制
|
|
24
|
+
- **适用场景**: 弹出层容器,用于展示弹窗、信息提示等内容,支持多个弹出层叠加展示
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 弹出层容器,用于展示弹窗、信息提示等内容,支持多个弹出层叠加展示 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `v-model:visible` | 控制当前组件显示/隐藏 | boolean | false |
|
|
37
|
+
| `z-index` | 遮罩层级 | string \ | number |
|
|
38
|
+
| `duration` | 组件显示/隐藏的动画时长,单位秒 | string \ | number |
|
|
39
|
+
| `lock-scroll` | 背景是否锁定 | boolean | true |
|
|
40
|
+
| `overlay` | 是否显示遮罩 | boolean | true |
|
|
41
|
+
| `close-on-click-overlay` | 是否点击遮罩关闭 | boolean | true |
|
|
42
|
+
| `position` | 弹出位置(top,bottom,left,right,center) | string | "center" |
|
|
43
|
+
| `transition` | 动画名 | string | - |
|
|
44
|
+
| `style` | 自定义弹框样式 | CSSProperties | - |
|
|
45
|
+
| `pop-class` | 自定义弹框类名 | string | - |
|
|
46
|
+
| `closeable` | 是否显示关闭按钮 | boolean | false |
|
|
47
|
+
| `close-icon-position` | 关闭按钮位置(top-left,top-right,bottom-left,bottom-right) | string | "top-right" |
|
|
48
|
+
| `destroy-on-close` | 弹层关闭后 slot内容会不会清空 | boolean | true |
|
|
49
|
+
| `round` | 是否显示圆角 | boolean | false |
|
|
50
|
+
| `teleport` | 指定挂载节点 | string | "body" |
|
|
51
|
+
| `teleport-disable` | 是否允许挂载节点 | boolean | false |
|
|
52
|
+
| `overlay-class` | 自定义遮罩层类名 | string | '' |
|
|
53
|
+
| `overlay-style` | 自定义遮罩层样式 | string | '' |
|
|
54
|
+
| `safe-area-inset-bottom` | 是否开启 iphone 系列全面屏底部安全区适配,仅当 position 为 bottom 时有效 | boolean | false |
|
|
55
|
+
|
|
56
|
+
### 2.2 Events 事件
|
|
57
|
+
|
|
58
|
+
| 事件名 | 类型 | 说明 |
|
|
59
|
+
| :--- | :--- | :--- |
|
|
60
|
+
| `click-pop` | 点击弹出层时触发 | event: Event |
|
|
61
|
+
| `click-close-icon` | 点击关闭图标时触发 | event: Event |
|
|
62
|
+
| `open` | 打开弹框时触发 | - |
|
|
63
|
+
| `close` | 关闭弹框时触发 | - |
|
|
64
|
+
| `opend` | 遮罩打开动画结束时触发 | event: Event |
|
|
65
|
+
| `closed` | 遮罩关闭动画结束时触发 | event: Event |
|
|
66
|
+
| `click-overlay` | 点击遮罩触发 | event: Event |
|
|
67
|
+
|
|
68
|
+
### 2.3 Methods 方法
|
|
69
|
+
|
|
70
|
+
| 方法名 | 参数 | 说明 |
|
|
71
|
+
| :--- | :--- | :--- |
|
|
72
|
+
无
|
|
73
|
+
|
|
74
|
+
### 2.4 Slots 插槽
|
|
75
|
+
|
|
76
|
+
| 插槽名 | 说明 |
|
|
77
|
+
| :--- | :--- |
|
|
78
|
+
| `default` | 自定义内嵌内容 |
|
|
79
|
+
| `close-icon` | 关闭按钮的自定义图标 |
|
|
80
|
+
|
|
81
|
+
## 3. 例子 (Examples)
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
## 4. 相关组件 (Related Components)
|
|
86
|
+
- **fox-js**: 与 Popup 配合使用的相关组件
|
|
87
|
+
- **fox-cell**: 与 Popup 配合使用的相关组件
|
|
88
|
+
|