@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,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: Price 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 价格组件
|
|
12
|
+
tags: [foxui, fox-price, FoxPrice]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Price 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
Price 是 foxui 中用于 **价格组件** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-price` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、适配 H5 与小程序多端
|
|
24
|
+
- **适用场景**: 价格组件
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 价格组件 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `price` | 价格数量 | Number | 0 |
|
|
37
|
+
| `need-symbol` | 是否需要加上 symbol 符号 | Boolean | true |
|
|
38
|
+
| `symbol` | 符号类型 | String | yen; |
|
|
39
|
+
| `decimal-length` | 小数位位数 | Number | 2 |
|
|
40
|
+
| `digits` | 分块长度,0的时候不分块 | Number | 3 |
|
|
41
|
+
| `separator` | 分块分割符 | String | , |
|
|
42
|
+
|
|
43
|
+
### 2.2 Events 事件
|
|
44
|
+
|
|
45
|
+
| 事件名 | 类型 | 说明 |
|
|
46
|
+
| :--- | :--- | :--- |
|
|
47
|
+
无
|
|
48
|
+
|
|
49
|
+
### 2.3 Methods 方法
|
|
50
|
+
|
|
51
|
+
| 方法名 | 参数 | 说明 |
|
|
52
|
+
| :--- | :--- | :--- |
|
|
53
|
+
无
|
|
54
|
+
|
|
55
|
+
### 2.4 Slots 插槽
|
|
56
|
+
|
|
57
|
+
| 插槽名 | 说明 |
|
|
58
|
+
| :--- | :--- |
|
|
59
|
+
无
|
|
60
|
+
|
|
61
|
+
## 3. 例子 (Examples)
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
## 4. 相关组件 (Related Components)
|
|
66
|
+
- **fox-js**: 与 Price 配合使用的相关组件
|
|
67
|
+
|
|
@@ -0,0 +1,74 @@
|
|
|
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: Progress 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 用来展示进度
|
|
12
|
+
tags: [foxui, fox-progress, FoxProgress]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-cell"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Progress 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
Progress 是 foxui 中用于 **用来展示进度** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-progress` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、适配 H5 与小程序多端、支持插槽扩展自定义内容、支持主题定制
|
|
24
|
+
- **适用场景**: 用来展示进度
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 用来展示进度 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `percentage` | 百分比 | Number | 0 |
|
|
37
|
+
| `is-show-percentage` | 是否需要展示百分号 | Boolean | true |
|
|
38
|
+
| `stroke-color` | 进度条背景色 | String | f30 |
|
|
39
|
+
| `stroke-width` | 进度条宽度 | String | '' |
|
|
40
|
+
| `size` | 进度条及文字尺寸,可选值small/base/large | String | - |
|
|
41
|
+
| `show-text` | 是否显示进度条文字内容 | Boolean | true |
|
|
42
|
+
| `text-inside` | 进度条文字显示位置false:外显,true:内显 | Boolean | false |
|
|
43
|
+
| `text-color` | 进度条文字颜色设置 | String | 333 |
|
|
44
|
+
| `text-background` | 进度条文字背景颜色设置 | String | 同进度条颜色 |
|
|
45
|
+
| `status` | 进度条当前状态,active展示动画效果/icon展示icon标签 | String | text |
|
|
46
|
+
| `icon-name` | icon名称 | String | checked |
|
|
47
|
+
| `icon-color` | icon颜色 | String | 439422 |
|
|
48
|
+
|
|
49
|
+
### 2.2 Events 事件
|
|
50
|
+
|
|
51
|
+
| 事件名 | 类型 | 说明 |
|
|
52
|
+
| :--- | :--- | :--- |
|
|
53
|
+
无
|
|
54
|
+
|
|
55
|
+
### 2.3 Methods 方法
|
|
56
|
+
|
|
57
|
+
| 方法名 | 参数 | 说明 |
|
|
58
|
+
| :--- | :--- | :--- |
|
|
59
|
+
无
|
|
60
|
+
|
|
61
|
+
### 2.4 Slots 插槽
|
|
62
|
+
|
|
63
|
+
| 插槽名 | 说明 |
|
|
64
|
+
| :--- | :--- |
|
|
65
|
+
| `icon-name` | 右侧 icon 内容 |
|
|
66
|
+
|
|
67
|
+
## 3. 例子 (Examples)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## 4. 相关组件 (Related Components)
|
|
72
|
+
- **fox-js**: 与 Progress 配合使用的相关组件
|
|
73
|
+
- **fox-cell**: 与 Progress 配合使用的相关组件
|
|
74
|
+
|
|
@@ -0,0 +1,77 @@
|
|
|
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: PullRefresh 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 在列表中通过手指下拉刷新加载新内容的交互操作
|
|
12
|
+
tags: [foxui, fox-pull-refresh, FoxPullRefresh]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-page","fox-content","fox-group","fox-row-item"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# PullRefresh 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
PullRefresh 是 foxui 中用于 **在列表中通过手指下拉刷新加载新内容的交互操作** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-pull-refresh` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
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` | 是否触发下拉刷新 | boolean | false |
|
|
37
|
+
| `pull-distance` | 触发下拉刷新的距离 | number \ | string |
|
|
38
|
+
| `head-height` | 顶部内容高度 | number \ | string |
|
|
39
|
+
| `loading-icon` | 加载中状态时,loading 图标。为空表示去掉 | string | loading |
|
|
40
|
+
| `pulling-text` | 下拉过程提示文案 | string | 下拉刷新 |
|
|
41
|
+
| `loosing-text` | 释放过程提示文案 | string | 释放刷新 |
|
|
42
|
+
| `loading-text` | 加载过程提示文案 | string | 加载中... |
|
|
43
|
+
| `duration` | 下拉动画加载时长 | number | 0.3 |
|
|
44
|
+
|
|
45
|
+
### 2.2 Events 事件
|
|
46
|
+
|
|
47
|
+
| 事件名 | 类型 | 说明 |
|
|
48
|
+
| :--- | :--- | :--- |
|
|
49
|
+
| `change` | 下拉过程或状态改变时触发 | status:string,distance:number |
|
|
50
|
+
| `refresh` | 下拉刷新事件回调 | - |
|
|
51
|
+
|
|
52
|
+
### 2.3 Methods 方法
|
|
53
|
+
|
|
54
|
+
| 方法名 | 参数 | 说明 |
|
|
55
|
+
| :--- | :--- | :--- |
|
|
56
|
+
无
|
|
57
|
+
|
|
58
|
+
### 2.4 Slots 插槽
|
|
59
|
+
|
|
60
|
+
| 插槽名 | 说明 |
|
|
61
|
+
| :--- | :--- |
|
|
62
|
+
| `pulling` | 下拉过程的顶部内容 |
|
|
63
|
+
| `loosing` | 释放过程中顶部内容 |
|
|
64
|
+
| `loading` | 加载过程中顶部内容 |
|
|
65
|
+
| `default` | 自定义内容 |
|
|
66
|
+
|
|
67
|
+
## 3. 例子 (Examples)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## 4. 相关组件 (Related Components)
|
|
72
|
+
- **fox-js**: 与 PullRefresh 配合使用的相关组件
|
|
73
|
+
- **fox-page**: 与 PullRefresh 配合使用的相关组件
|
|
74
|
+
- **fox-content**: 与 PullRefresh 配合使用的相关组件
|
|
75
|
+
- **fox-group**: 与 PullRefresh 配合使用的相关组件
|
|
76
|
+
- **fox-row-item**: 与 PullRefresh 配合使用的相关组件
|
|
77
|
+
|
|
@@ -0,0 +1,384 @@
|
|
|
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: RadioItem 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 单选按钮组
|
|
12
|
+
tags: [foxui, fox-radio-item, FoxRadioItem]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-item","fox-row-item","fox-button","fox-group","fox-switch-item"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# RadioItem 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
RadioItem 是 foxui 中用于 **单选按钮组** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-radio-item` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
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
|
+
| `disabled` | 是否禁用选择 | boolean | false |
|
|
37
|
+
| `icon-size` | 图标尺寸 | string \ | number |
|
|
38
|
+
| `label` | 单选框标识 | string \ | number \ |
|
|
39
|
+
| `shape` | 形状,可选值为 button、round | string | round |
|
|
40
|
+
|
|
41
|
+
### 2.2 Events 事件
|
|
42
|
+
|
|
43
|
+
| 事件名 | 类型 | 说明 |
|
|
44
|
+
| :--- | :--- | :--- |
|
|
45
|
+
| `change` | 值变化时触发 | 当前选中项值(value)设置value后有值、默认为空 |
|
|
46
|
+
|
|
47
|
+
### 2.3 Methods 方法
|
|
48
|
+
|
|
49
|
+
| 方法名 | 参数 | 说明 |
|
|
50
|
+
| :--- | :--- | :--- |
|
|
51
|
+
| `clear` | 清空radio-group得选中状态 | - |
|
|
52
|
+
|
|
53
|
+
### 2.4 Slots 插槽
|
|
54
|
+
|
|
55
|
+
| 插槽名 | 说明 |
|
|
56
|
+
| :--- | :--- |
|
|
57
|
+
| `options` | source为空的情况下,直接编写radio列表 |
|
|
58
|
+
| `default` | label |
|
|
59
|
+
| `text` | 自定义radio项的text内容 |
|
|
60
|
+
| `icon` | 默认图标 |
|
|
61
|
+
| `checkedIcon` | 选中图标 |
|
|
62
|
+
|
|
63
|
+
## 3. 例子 (Examples)
|
|
64
|
+
|
|
65
|
+
## 代码演示
|
|
66
|
+
### 左侧位置
|
|
67
|
+
使用`v-model`绑定值当前选项的`value`, 并且通过`source`属性设置radio列表, 并可通过`text-position`设置label的位置
|
|
68
|
+
```html
|
|
69
|
+
<fox-radio-item v-model="val" :source="m_items" text-position="left"></fox-radio-item>
|
|
70
|
+
```
|
|
71
|
+
```ts
|
|
72
|
+
import { ref } from 'vue'
|
|
73
|
+
const val = ref('1')
|
|
74
|
+
const m_items = ref([
|
|
75
|
+
{ text: '单选框1', value: '1' },
|
|
76
|
+
{ text: '单选框2', value: '2' },
|
|
77
|
+
{ text: '单选框3', value: '3' }
|
|
78
|
+
])
|
|
79
|
+
```
|
|
80
|
+
### 右侧位置
|
|
81
|
+
通过`text-position`设置label的位置
|
|
82
|
+
```html
|
|
83
|
+
<fox-radio-item v-model="val" :source="m_items"></fox-radio-item>
|
|
84
|
+
```
|
|
85
|
+
```ts
|
|
86
|
+
import { ref } from 'vue'
|
|
87
|
+
const val = ref('1')
|
|
88
|
+
const m_items = ref([
|
|
89
|
+
{ text: '单选框1', value: '1' },
|
|
90
|
+
{ text: '单选框2', value: '2' },
|
|
91
|
+
{ text: '单选框3', value: '3' }
|
|
92
|
+
])
|
|
93
|
+
```
|
|
94
|
+
### 按钮形状
|
|
95
|
+
通过`shape`设置radio item的外形
|
|
96
|
+
```html
|
|
97
|
+
<fox-radio-item v-model="val" :source="m_items" shape="button"> </fox-radio-item>
|
|
98
|
+
```
|
|
99
|
+
```ts
|
|
100
|
+
import { ref } from 'vue'
|
|
101
|
+
const val = ref('1')
|
|
102
|
+
const m_items = ref([
|
|
103
|
+
{ text: '单选框1', value: '1' },
|
|
104
|
+
{ text: '单选框2', value: '2' },
|
|
105
|
+
{ text: '单选框3', value: '3' }
|
|
106
|
+
])
|
|
107
|
+
```
|
|
108
|
+
### 水平布局
|
|
109
|
+
通过设置`direction`属性来达到水平布局的效果
|
|
110
|
+
```html
|
|
111
|
+
<fox-radio-item v-model="val" :source="m_items" direction="horizontal" text-position="left"></fox-radio-item>
|
|
112
|
+
<fox-radio-item v-model="val" :source="m_items" direction="horizontal"></fox-radio-item>
|
|
113
|
+
<fox-radio-item v-model="val" :source="m_items" shape="button" direction="horizontal"></fox-radio-item>
|
|
114
|
+
```
|
|
115
|
+
```ts
|
|
116
|
+
import { ref } from 'vue'
|
|
117
|
+
const val = ref('1')
|
|
118
|
+
const m_items = ref([
|
|
119
|
+
{ text: '单选框1', value: '1' },
|
|
120
|
+
{ text: '单选框2', value: '2' },
|
|
121
|
+
{ text: '单选框3', value: '3' }
|
|
122
|
+
])
|
|
123
|
+
```
|
|
124
|
+
### 自定义样式
|
|
125
|
+
通过`icon-size`属性来控制图标的大小,另外通过插槽`icon`和`chekcedIcon`来设置自定义图标
|
|
126
|
+
```html
|
|
127
|
+
<fox-radio-item v-model="val2" :source="m_items2" icon-size="12px"> </fox-radio-item>
|
|
128
|
+
<fox-radio-item v-model="val3" :source="m_items3">
|
|
129
|
+
<template v-slot:icon><Checklist></Checklist></template>
|
|
130
|
+
<template v-slot:checkedIcon><Checklist color="red"></Checklist></template>
|
|
131
|
+
</fox-radio-item>
|
|
132
|
+
```
|
|
133
|
+
```ts
|
|
134
|
+
import { ref } from 'vue'
|
|
135
|
+
import { Checklist } from '@fox-js/icons-vue'
|
|
136
|
+
const val2 = ref('2')
|
|
137
|
+
const m_items2 = ref([
|
|
138
|
+
{ text: '自定义尺寸12', value: '1' },
|
|
139
|
+
{ text: '自定义尺寸12', value: '2' }
|
|
140
|
+
])
|
|
141
|
+
const val3 = ref('1')
|
|
142
|
+
const m_items3 = ref([
|
|
143
|
+
{ text: '自定义图标', value: '1' },
|
|
144
|
+
{ text: '自定义图标', value: '2' }
|
|
145
|
+
])
|
|
146
|
+
```
|
|
147
|
+
### 只读/禁用
|
|
148
|
+
通过`readonly`和`disabled`属性设置
|
|
149
|
+
```html
|
|
150
|
+
<fox-radio-item v-model="val4" :source="m_items4" disabled="true"> </fox-radio-item>
|
|
151
|
+
<fox-radio-item v-model="val4" :source="m_items4" readonly="true"> </fox-radio-item>
|
|
152
|
+
```
|
|
153
|
+
### 部分禁用选择
|
|
154
|
+
```html
|
|
155
|
+
<fox-radio-item v-model="val5" :source="m_items5"></fox-radio-item>
|
|
156
|
+
```
|
|
157
|
+
```ts
|
|
158
|
+
import { ref } from 'vue'
|
|
159
|
+
const val5 = ref('')
|
|
160
|
+
const m_items5 = ref([
|
|
161
|
+
{ text: '部分禁用1', value: '1', disabled: true },
|
|
162
|
+
{ text: '部分禁用2', value: '2' }
|
|
163
|
+
])
|
|
164
|
+
```
|
|
165
|
+
### 返回类型
|
|
166
|
+
通过fox-radio-item组件**value-type**设置v-model绑定的数据类型
|
|
167
|
+
* `value`(默认) 绑定`item`对象的`item.value`
|
|
168
|
+
* text 绑定item对象的item.text
|
|
169
|
+
* item 绑定item对象
|
|
170
|
+
### 返回value类型(默认)
|
|
171
|
+
```html
|
|
172
|
+
<fox-radio-item v-model="val6" :source="m_items6"></fox-radio-item>
|
|
173
|
+
```
|
|
174
|
+
```ts
|
|
175
|
+
import {ref} from 'vue'
|
|
176
|
+
const val6 = ref('1')
|
|
177
|
+
const m_items6 = ref([
|
|
178
|
+
{ text: '返回value1', value: '1' },
|
|
179
|
+
{ text: '返回value2', value: '2' },
|
|
180
|
+
{ text: '返回value3', value: '3' }
|
|
181
|
+
])
|
|
182
|
+
```
|
|
183
|
+
### 返回text类型
|
|
184
|
+
```html
|
|
185
|
+
<fox-radio-item value-type="text" v-model="val8" :source="m_items8"></fox-radio-item>
|
|
186
|
+
```
|
|
187
|
+
```ts
|
|
188
|
+
import {ref} from 'vue'
|
|
189
|
+
const val7 = ref('返回text2')
|
|
190
|
+
const m_items7 = ref([
|
|
191
|
+
{ text: '返回text1', value: '1' },
|
|
192
|
+
{ text: '返回text2', value: '2' },
|
|
193
|
+
{ text: '返回text3', value: '3' }
|
|
194
|
+
])
|
|
195
|
+
```
|
|
196
|
+
### 返回item类型
|
|
197
|
+
```html
|
|
198
|
+
<fox-radio-item value-type="item" v-model="val8" :source="m_items8"></fox-radio-item>
|
|
199
|
+
```
|
|
200
|
+
```ts
|
|
201
|
+
import { ref } from 'vue'
|
|
202
|
+
const val8 = ref({ text: '返回Item3', value: '3' })
|
|
203
|
+
const m_items8 = ref([
|
|
204
|
+
{ text: '返回Item1', value: '1' },
|
|
205
|
+
{ text: '返回Item2', value: '2' },
|
|
206
|
+
{ text: '返回Item3', value: '3' }
|
|
207
|
+
])
|
|
208
|
+
```
|
|
209
|
+
### 触发事件与方法
|
|
210
|
+
点击fox-radio-item组件的radio能触发change事件
|
|
211
|
+
```html
|
|
212
|
+
<fox-radio-item ref="radioRef" v-model="val9" :source="m_items9" @change="handleChange"></fox-radio-item>
|
|
213
|
+
<fox-item label-width="120px">
|
|
214
|
+
<template v-slot:label><span style="color: red">当前选择值:</span></template>
|
|
215
|
+
<template v-slot:default>{{ JSON.stringify(val9) }}</template>
|
|
216
|
+
</fox-item>
|
|
217
|
+
<fox-row-item>
|
|
218
|
+
<fox-button type="primary" @click="onClear">清理</fox-button>
|
|
219
|
+
</fox-row-item>
|
|
220
|
+
```
|
|
221
|
+
```ts
|
|
222
|
+
import { ref } from 'vue'
|
|
223
|
+
const val9 = ref('1')
|
|
224
|
+
const m_items9 = ref([
|
|
225
|
+
{ text: '触发事件', value: '1' },
|
|
226
|
+
{ text: '触发事件', value: '2' }
|
|
227
|
+
])
|
|
228
|
+
const handleChange = (value: any) => {
|
|
229
|
+
Toast.text(`您选中了${value}`)
|
|
230
|
+
}
|
|
231
|
+
const radioRef = ref<any>(null)
|
|
232
|
+
// 清空选择状态
|
|
233
|
+
const onClear = () => {
|
|
234
|
+
radioRef.value.clear()
|
|
235
|
+
}
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### 数据源
|
|
239
|
+
|
|
240
|
+
通过属性`source`可以设置radio item的数据源,目前支持数组、函数和API服务三种数据源, 另外还支持异构(需要配合`text-key`和`value-key`两个属性),另外可以通过`source-filter`属性对数据源进行最终的过滤(一般配合`服务API数据源`使用)
|
|
241
|
+
|
|
242
|
+
```ts
|
|
243
|
+
<script lang="ts" setup>
|
|
244
|
+
import { ref, watch, computed } from 'vue'
|
|
245
|
+
import { setAPI } from '@/api'
|
|
246
|
+
|
|
247
|
+
// 注册api代理函数,模拟api请求
|
|
248
|
+
setAPI('checkbox', (path: string, params: any) => {
|
|
249
|
+
console.info(`处理checkbox获取数据请求, path:${path} params:`, params)
|
|
250
|
+
if (path === 'provide') {
|
|
251
|
+
return new Promise<any>(resolve => {
|
|
252
|
+
setTimeout(() => {
|
|
253
|
+
resolve([
|
|
254
|
+
{ text: '广东省', value: 'a' },
|
|
255
|
+
{ text: '江苏省', value: 'b' },
|
|
256
|
+
{ text: '浙江省', value: 'c' },
|
|
257
|
+
{ text: '福建省', value: 'd' },
|
|
258
|
+
{ text: '四川省', value: 'e' },
|
|
259
|
+
{ text: '云南省', value: 'f' }
|
|
260
|
+
])
|
|
261
|
+
}, 500)
|
|
262
|
+
})
|
|
263
|
+
} else {
|
|
264
|
+
return new Promise<any>(resolve => {
|
|
265
|
+
setTimeout(() => {
|
|
266
|
+
resolve([
|
|
267
|
+
{ text: '南京', value: '01' },
|
|
268
|
+
{ text: '无锡', value: '02' },
|
|
269
|
+
{ text: '苏州', value: '03' },
|
|
270
|
+
{ text: '无锡', value: '04' },
|
|
271
|
+
{ text: '台州', value: '05' },
|
|
272
|
+
{ text: '杭州', value: '06' },
|
|
273
|
+
{ text: '宁波', value: '07' }
|
|
274
|
+
])
|
|
275
|
+
}, 500)
|
|
276
|
+
})
|
|
277
|
+
}
|
|
278
|
+
})
|
|
279
|
+
|
|
280
|
+
// 数组数据源
|
|
281
|
+
const sourceForArray = ref([
|
|
282
|
+
{
|
|
283
|
+
text: '跳绳',
|
|
284
|
+
value: '01'
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
text: '游泳',
|
|
288
|
+
value: '02'
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
text: '篮球',
|
|
292
|
+
value: '03'
|
|
293
|
+
}
|
|
294
|
+
])
|
|
295
|
+
// 函数数据源
|
|
296
|
+
const sourceForFunction = (): Promise<Record<string, any>[]> => {
|
|
297
|
+
return new Promise<Record<string, any>[]>(resolve => {
|
|
298
|
+
resolve([
|
|
299
|
+
{
|
|
300
|
+
text: '足球',
|
|
301
|
+
value: 1
|
|
302
|
+
},
|
|
303
|
+
{
|
|
304
|
+
text: '篮球',
|
|
305
|
+
value: 2
|
|
306
|
+
},
|
|
307
|
+
{
|
|
308
|
+
text: '排球',
|
|
309
|
+
value: 3
|
|
310
|
+
}
|
|
311
|
+
])
|
|
312
|
+
})
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// 异构数据源
|
|
316
|
+
const sourceForOtherType = ref([
|
|
317
|
+
{
|
|
318
|
+
id: '001',
|
|
319
|
+
name: '刘德华'
|
|
320
|
+
},
|
|
321
|
+
{
|
|
322
|
+
id: '002',
|
|
323
|
+
name: '黎明'
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
id: '003',
|
|
327
|
+
name: '张学友'
|
|
328
|
+
},
|
|
329
|
+
{
|
|
330
|
+
id: '004',
|
|
331
|
+
name: '郭富城'
|
|
332
|
+
}
|
|
333
|
+
])
|
|
334
|
+
|
|
335
|
+
let val = ref(['01'])
|
|
336
|
+
let val2 = ref([1])
|
|
337
|
+
let val3 = ref('')
|
|
338
|
+
let val4 = ref('')
|
|
339
|
+
watch([val, val2, val3, val4], ([newVal, newVal2, newVal3, newVal4]) => {
|
|
340
|
+
console.info('checkbox value change', newVal, newVal2, newVal3, newVal4)
|
|
341
|
+
})
|
|
342
|
+
|
|
343
|
+
// 省份value
|
|
344
|
+
const val5 = ref('')
|
|
345
|
+
// source filter
|
|
346
|
+
const sourceFilter = (item: Record<string, any>) => {
|
|
347
|
+
if (isCoastalRegion.value) {
|
|
348
|
+
return ['a', 'b', 'c', 'd'].includes(item.value)
|
|
349
|
+
} else {
|
|
350
|
+
return ['e', 'f'].includes(item.value)
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
// source filter
|
|
354
|
+
// 是否沿海省份
|
|
355
|
+
const isCoastalRegion = ref(true)
|
|
356
|
+
// coastal region text
|
|
357
|
+
const coastalRegionText = computed(() => {
|
|
358
|
+
return isCoastalRegion.value ? '沿海省份' : '内地省份'
|
|
359
|
+
})
|
|
360
|
+
</script>
|
|
361
|
+
|
|
362
|
+
<template>
|
|
363
|
+
<fox-group :column="1" label-width="150px">
|
|
364
|
+
<fox-radio-item v-model="val" :source="sourceForArray">数组数据源</fox-radio-item>
|
|
365
|
+
<fox-radio-item v-model="val2" :source="sourceForFunction">函数函数源</fox-radio-item>
|
|
366
|
+
<fox-radio-item v-model="val3" source="/metadata/city">API数据源</fox-radio-item>
|
|
367
|
+
<fox-radio-item v-model="val4" :source="sourceForOtherType" text-key="name" value-key="id"
|
|
368
|
+
>异构数据源</fox-radio-item
|
|
369
|
+
>
|
|
370
|
+
<fox-radio-item v-model="val5" source="provide" :source-filter="sourceFilter">省份</fox-radio-item>
|
|
371
|
+
<fox-switch-item v-model="isCoastalRegion">{{ coastalRegionText }}</fox-switch-item>
|
|
372
|
+
</fox-group>
|
|
373
|
+
</template>
|
|
374
|
+
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
## 4. 相关组件 (Related Components)
|
|
378
|
+
- **fox-js**: 与 RadioItem 配合使用的相关组件
|
|
379
|
+
- **fox-item**: 与 RadioItem 配合使用的相关组件
|
|
380
|
+
- **fox-row-item**: 与 RadioItem 配合使用的相关组件
|
|
381
|
+
- **fox-button**: 与 RadioItem 配合使用的相关组件
|
|
382
|
+
- **fox-group**: 与 RadioItem 配合使用的相关组件
|
|
383
|
+
- **fox-switch-item**: 与 RadioItem 配合使用的相关组件
|
|
384
|
+
|
|
@@ -0,0 +1,65 @@
|
|
|
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: Range 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 滑动输入条,用于在给定的范围内选择一个值。
|
|
12
|
+
tags: [foxui, fox-range, FoxRange]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-cell"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Range 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
Range 是 foxui 中用于 **滑动输入条,用于在给定的范围内选择一个值。** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-range` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
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
|
+
无
|
|
37
|
+
|
|
38
|
+
### 2.2 Events 事件
|
|
39
|
+
|
|
40
|
+
| 事件名 | 类型 | 说明 |
|
|
41
|
+
| :--- | :--- | :--- |
|
|
42
|
+
| `change` | 进度变化且结束拖动后触发 | value: number \ |
|
|
43
|
+
| `drag-start` | 开始拖动时触发 | - |
|
|
44
|
+
| `drag-end` | 结束拖动时触发 | - |
|
|
45
|
+
|
|
46
|
+
### 2.3 Methods 方法
|
|
47
|
+
|
|
48
|
+
| 方法名 | 参数 | 说明 |
|
|
49
|
+
| :--- | :--- | :--- |
|
|
50
|
+
无
|
|
51
|
+
|
|
52
|
+
### 2.4 Slots 插槽
|
|
53
|
+
|
|
54
|
+
| 插槽名 | 说明 |
|
|
55
|
+
| :--- | :--- |
|
|
56
|
+
| `button` | 自定义滑动按钮 |
|
|
57
|
+
|
|
58
|
+
## 3. 例子 (Examples)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## 4. 相关组件 (Related Components)
|
|
63
|
+
- **fox-js**: 与 Range 配合使用的相关组件
|
|
64
|
+
- **fox-cell**: 与 Range 配合使用的相关组件
|
|
65
|
+
|