@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,199 @@
|
|
|
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: InputNumber 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 数字输入框组件
|
|
12
|
+
tags: [foxui, fox-input-number, FoxInputNumber]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-i","fox-iconfont","fox-icon"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# InputNumber 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
InputNumber 是 foxui 中用于 **数字输入框组件** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-input-number` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
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
|
+
| `v-model` | 初始值 | String、Number | - |
|
|
37
|
+
| `input-width` | 输入框宽度 | String | 40px |
|
|
38
|
+
| `button-size` | 操作符+、-尺寸 | String | 20px |
|
|
39
|
+
| `min` | 最小值限制 | String、Number | 1 |
|
|
40
|
+
| `max` | 最大值限制 | String、Number | 9999 |
|
|
41
|
+
| `step` | 步长 | String、Number | 1 |
|
|
42
|
+
| `decimal-places` | 设置保留的小数位 | String、Number | 0 |
|
|
43
|
+
| `disabled` | 禁用所有功能 | Boolean | false |
|
|
44
|
+
| `readonly` | 只读状态禁用输入框操作行为 | Boolean | false |
|
|
45
|
+
| `icon-left` | 左侧操作符图标名,同 Icon 组件 name 属性 | String | minus |
|
|
46
|
+
| `icon-right` | 右侧操作符图标名,同 Icon 组件 name 属性 | String | plus |
|
|
47
|
+
| `font-class-name` | 自定义icon 字体基础类名 | String | fox-iconfont |
|
|
48
|
+
| `class-prefix` | 自定义icon 类名前缀,用于使用自定义图标 | String | fox-icon |
|
|
49
|
+
|
|
50
|
+
### 2.2 Events 事件
|
|
51
|
+
|
|
52
|
+
| 事件名 | 类型 | 说明 |
|
|
53
|
+
| :--- | :--- | :--- |
|
|
54
|
+
| `add` | 点击增加按钮时触发 | event: Event |
|
|
55
|
+
| `reduce` | 点击减少按钮时触发 | event: Event |
|
|
56
|
+
| `overlimit` | 点击不可用的按钮时触发 | event: Event,type:string reduce or add |
|
|
57
|
+
| `change` | 值改变时触发 | value: number , event : Event |
|
|
58
|
+
| `blur` | 输入框失去焦点时触发 | event: Event |
|
|
59
|
+
| `focus` | 输入框获得焦点时触发 | event: Event |
|
|
60
|
+
|
|
61
|
+
### 2.3 Methods 方法
|
|
62
|
+
|
|
63
|
+
| 方法名 | 参数 | 说明 |
|
|
64
|
+
| :--- | :--- | :--- |
|
|
65
|
+
无
|
|
66
|
+
|
|
67
|
+
### 2.4 Slots 插槽
|
|
68
|
+
|
|
69
|
+
| 插槽名 | 说明 |
|
|
70
|
+
| :--- | :--- |
|
|
71
|
+
无
|
|
72
|
+
|
|
73
|
+
## 3. 例子 (Examples)
|
|
74
|
+
|
|
75
|
+
## 代码演示
|
|
76
|
+
|
|
77
|
+
### 基础用法
|
|
78
|
+
|
|
79
|
+
初始化一个默认值
|
|
80
|
+
|
|
81
|
+
``` html
|
|
82
|
+
<fox-input-number v-model="value" />
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
``` javascript
|
|
86
|
+
import { ref } from 'vue';
|
|
87
|
+
|
|
88
|
+
export default {
|
|
89
|
+
setup() {
|
|
90
|
+
const value = ref(1);
|
|
91
|
+
return { value };
|
|
92
|
+
},
|
|
93
|
+
};
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 步长设置
|
|
97
|
+
|
|
98
|
+
设置步长 `step` 5
|
|
99
|
+
|
|
100
|
+
```html
|
|
101
|
+
<fox-input-number v-model="value" step="5" />
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### 限制输入范围
|
|
105
|
+
|
|
106
|
+
`min` 和 `max` 属性分别表示最小值和最大值
|
|
107
|
+
|
|
108
|
+
```html
|
|
109
|
+
<fox-i pu t v-model="value" min="10" max="20" />
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### 禁用状态
|
|
113
|
+
|
|
114
|
+
`disabled` 禁用状态下无法点击按钮或修改输入框。
|
|
115
|
+
|
|
116
|
+
```html
|
|
117
|
+
<fox-input-number v-model="value" disabled />
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### 只读禁用输入框
|
|
121
|
+
|
|
122
|
+
`readonly` 设置只读禁用输入框输入行为
|
|
123
|
+
|
|
124
|
+
```html
|
|
125
|
+
<fox-input-number v-model="value" readonly />
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### 支持小数点
|
|
129
|
+
|
|
130
|
+
设置步长 `step` 0.1 `decimal-places` 小数保留1位
|
|
131
|
+
|
|
132
|
+
```html
|
|
133
|
+
<fox-input-number v-model="value" step="0.1" decimal-places="1" />
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
### 支持异步修改
|
|
137
|
+
|
|
138
|
+
通过 `change` 事件和 `model-value` 进行异步修改
|
|
139
|
+
|
|
140
|
+
```html
|
|
141
|
+
<fox-input-number :model-value="value" @change="onChange" />
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
``` javascript
|
|
145
|
+
import { ref } from 'vue';
|
|
146
|
+
|
|
147
|
+
export default {
|
|
148
|
+
setup() {
|
|
149
|
+
const value = ref(1);
|
|
150
|
+
const onChange = (value: number) => {
|
|
151
|
+
setTimeout(() => {
|
|
152
|
+
value.value = value;
|
|
153
|
+
}, 2000);
|
|
154
|
+
};
|
|
155
|
+
return { value, onChange };
|
|
156
|
+
},
|
|
157
|
+
};
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### 自定义按钮大小
|
|
161
|
+
|
|
162
|
+
设置步长 `step` 0.1 `decimal-places` 小数保留1位
|
|
163
|
+
|
|
164
|
+
```html
|
|
165
|
+
<fox-input-number v-model="value" button-size="30" input-width="50" />
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
### 自定义按钮图标
|
|
169
|
+
|
|
170
|
+
```html
|
|
171
|
+
<template>
|
|
172
|
+
<fox-input-number v-model="value">
|
|
173
|
+
<template #left-icon>
|
|
174
|
+
<Left />
|
|
175
|
+
</template>
|
|
176
|
+
<template #right-icon>
|
|
177
|
+
<Right />
|
|
178
|
+
</template>
|
|
179
|
+
</fox-input-number>
|
|
180
|
+
</template>
|
|
181
|
+
<script lang="ts">
|
|
182
|
+
import { ref } from 'vue'
|
|
183
|
+
import { Left, Right } from '@fox-js/icons-vue'
|
|
184
|
+
export default {
|
|
185
|
+
props: {},
|
|
186
|
+
setup() {
|
|
187
|
+
const value = ref(1);
|
|
188
|
+
return { value };
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
</script>
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
## 4. 相关组件 (Related Components)
|
|
195
|
+
- **fox-js**: 与 InputNumber 配合使用的相关组件
|
|
196
|
+
- **fox-i**: 与 InputNumber 配合使用的相关组件
|
|
197
|
+
- **fox-iconfont**: 与 InputNumber 配合使用的相关组件
|
|
198
|
+
- **fox-icon**: 与 InputNumber 配合使用的相关组件
|
|
199
|
+
|
|
@@ -0,0 +1,213 @@
|
|
|
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: InputNumberItem 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 数字输入框
|
|
12
|
+
tags: [foxui, fox-input-number-item, FoxInputNumberItem]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-iconfont","fox-icon"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# InputNumberItem 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
InputNumberItem 是 foxui 中用于 **数字输入框** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-input-number-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
|
+
| `v-model` | 输入值,双向绑定 | String | - |
|
|
37
|
+
| `placeholder` | 为空时占位符 | String | - |
|
|
38
|
+
| `clearable` | 展示清除icon | Boolean | true |
|
|
39
|
+
| `text-align` | 文本位置,可选值left,center,right | String | right |
|
|
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
|
+
| `input-width` | 输入框宽度 | String | 40px |
|
|
53
|
+
| `button-size` | 操作符+、-尺寸 | String | 20px |
|
|
54
|
+
| `min` | 最小值限制 | String、Number | 1 |
|
|
55
|
+
| `max` | 最大值限制 | String、Number | 9999 |
|
|
56
|
+
| `step` | 步长 | String、Number | 1 |
|
|
57
|
+
| `decimal-places` | 设置保留的小数位 | String、Number | 0 |
|
|
58
|
+
| `disabled` | 禁用所有功能 | Boolean | false |
|
|
59
|
+
| `readonly` | 只读状态禁用输入框操作行为 | Boolean | false |
|
|
60
|
+
| `icon-left` | 左侧操作符图标名,同 Icon 组件 name 属性 | String | minus |
|
|
61
|
+
| `icon-right` | 右侧操作符图标名,同 Icon 组件 name 属性 | String | plus |
|
|
62
|
+
| `font-class-name` | 自定义icon 字体基础类名 | String | fox-iconfont |
|
|
63
|
+
| `class-prefix` | 自定义icon 类名前缀,用于使用自定义图标 | String | fox-icon |
|
|
64
|
+
|
|
65
|
+
### 2.2 Events 事件
|
|
66
|
+
|
|
67
|
+
| 事件名 | 类型 | 说明 |
|
|
68
|
+
| :--- | :--- | :--- |
|
|
69
|
+
| `add` | 点击增加按钮时触发 | event: Event |
|
|
70
|
+
| `reduce` | 点击减少按钮时触发 | event: Event |
|
|
71
|
+
| `overlimit` | 点击不可用的按钮时触发 | event: Event,type:string reduce or add |
|
|
72
|
+
| `change` | 值改变时触发 | value: number , event : Event |
|
|
73
|
+
| `blur` | 输入框失去焦点时触发 | event: Event |
|
|
74
|
+
| `focus` | 输入框获得焦点时触发 | event: Event |
|
|
75
|
+
|
|
76
|
+
### 2.3 Methods 方法
|
|
77
|
+
|
|
78
|
+
| 方法名 | 参数 | 说明 |
|
|
79
|
+
| :--- | :--- | :--- |
|
|
80
|
+
无
|
|
81
|
+
|
|
82
|
+
### 2.4 Slots 插槽
|
|
83
|
+
|
|
84
|
+
| 插槽名 | 说明 |
|
|
85
|
+
| :--- | :--- |
|
|
86
|
+
无
|
|
87
|
+
|
|
88
|
+
## 3. 例子 (Examples)
|
|
89
|
+
|
|
90
|
+
## 代码演示
|
|
91
|
+
|
|
92
|
+
### 基础用法
|
|
93
|
+
|
|
94
|
+
初始化一个默认值
|
|
95
|
+
|
|
96
|
+
``` html
|
|
97
|
+
<fox-input-number-item v-model="value">基本用法</fox-input-number-item>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
``` javascript
|
|
101
|
+
import { ref } from 'vue';
|
|
102
|
+
|
|
103
|
+
export default {
|
|
104
|
+
setup() {
|
|
105
|
+
const value = ref(1);
|
|
106
|
+
return { value };
|
|
107
|
+
},
|
|
108
|
+
};
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### 步长设置
|
|
112
|
+
|
|
113
|
+
设置步长 `step` 5
|
|
114
|
+
|
|
115
|
+
```html
|
|
116
|
+
<fox-input-number-item v-model="value" step="5">步长设置</fox-input-number-item>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### 限制输入范围
|
|
120
|
+
|
|
121
|
+
`min` 和 `max` 属性分别表示最小值和最大值
|
|
122
|
+
|
|
123
|
+
```html
|
|
124
|
+
<fox-input-number-item v-model="value" @overlimit="overlimit" min="10" max="20">限制输入</fox-input-number-item>
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### 禁用状态
|
|
128
|
+
|
|
129
|
+
`disabled` 禁用状态下无法点击按钮或修改输入框。
|
|
130
|
+
|
|
131
|
+
```html
|
|
132
|
+
<fox-input-number-item v-model="value" disabled>禁用状态</fox-input-number-item>
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### 只读禁用输入框
|
|
136
|
+
|
|
137
|
+
`readonly` 设置只读禁用输入框输入行为
|
|
138
|
+
|
|
139
|
+
```html
|
|
140
|
+
<fox-input-number-item v-model="value" readonly>只读</fox-input-number-item>
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### 支持小数点
|
|
144
|
+
|
|
145
|
+
设置步长 `step` 0.1 `decimal-places` 小数保留1位
|
|
146
|
+
|
|
147
|
+
```html
|
|
148
|
+
<fox-input-number-item v-model="value" step="0.1" decimal-places="1" readonly>支持小数</fox-input-number-item>
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 支持异步修改
|
|
152
|
+
|
|
153
|
+
通过 `change` 事件和 `model-value` 进行异步修改
|
|
154
|
+
|
|
155
|
+
```html
|
|
156
|
+
<fox-input-number-item :model-value="value" @change="onChange">异步修改</fox-input-number-item>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
``` javascript
|
|
160
|
+
import { ref } from 'vue';
|
|
161
|
+
|
|
162
|
+
export default {
|
|
163
|
+
setup() {
|
|
164
|
+
const value = ref(1);
|
|
165
|
+
const onChange = (value: number) => {
|
|
166
|
+
setTimeout(() => {
|
|
167
|
+
value.value = value;
|
|
168
|
+
}, 2000);
|
|
169
|
+
};
|
|
170
|
+
return { value, onChange };
|
|
171
|
+
},
|
|
172
|
+
};
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### 自定义按钮大小
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
```html
|
|
179
|
+
<fox-input-number-item v-model="state.val7" button-size="30" input-width="50">自定义按钮大小</fox-input-number-item>
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### 自定义按钮图标
|
|
183
|
+
|
|
184
|
+
```html
|
|
185
|
+
<template>
|
|
186
|
+
<fox-input-number-item v-model="value">
|
|
187
|
+
自定义按钮图标
|
|
188
|
+
<template #left-icon>
|
|
189
|
+
<Left />
|
|
190
|
+
</template>
|
|
191
|
+
<template #right-icon>
|
|
192
|
+
<Right />
|
|
193
|
+
</template>
|
|
194
|
+
</fox-input-number-item>
|
|
195
|
+
</template>
|
|
196
|
+
<script lang="ts">
|
|
197
|
+
import { ref } from 'vue'
|
|
198
|
+
import { Left, Right } from '@fox-js/icons-vue'
|
|
199
|
+
export default {
|
|
200
|
+
props: {},
|
|
201
|
+
setup() {
|
|
202
|
+
const value = ref(1);
|
|
203
|
+
return { value };
|
|
204
|
+
},
|
|
205
|
+
};
|
|
206
|
+
</script>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## 4. 相关组件 (Related Components)
|
|
210
|
+
- **fox-js**: 与 InputNumberItem 配合使用的相关组件
|
|
211
|
+
- **fox-iconfont**: 与 InputNumberItem 配合使用的相关组件
|
|
212
|
+
- **fox-icon**: 与 InputNumberItem 配合使用的相关组件
|
|
213
|
+
|
|
@@ -0,0 +1,207 @@
|
|
|
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: Item 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 组件单元
|
|
12
|
+
tags: [foxui, fox-item, FoxItem]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-icon","fox-input","fox-row-item","fox-group","fox-input-item","fox-date-item","fox-select-item"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Item 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
Item 是 foxui 中用于 **组件单元** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-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
|
+
| `max-display-count` | 最大显示组件数量 | number | - |
|
|
37
|
+
| `more-text` | 更多文本 | string | 更多 |
|
|
38
|
+
| `more-icon` | 更多图标 | component | - |
|
|
39
|
+
|
|
40
|
+
### 2.2 Events 事件
|
|
41
|
+
|
|
42
|
+
| 事件名 | 类型 | 说明 |
|
|
43
|
+
| :--- | :--- | :--- |
|
|
44
|
+
| `appear` | item可见事件 |
|
|
45
|
+
| `disappear` | item不可见事件 |
|
|
46
|
+
|
|
47
|
+
### 2.3 Methods 方法
|
|
48
|
+
|
|
49
|
+
| 方法名 | 参数 | 说明 |
|
|
50
|
+
| :--- | :--- | :--- |
|
|
51
|
+
无
|
|
52
|
+
|
|
53
|
+
### 2.4 Slots 插槽
|
|
54
|
+
|
|
55
|
+
| 插槽名 | 说明 |
|
|
56
|
+
| :--- | :--- |
|
|
57
|
+
| `default` | 按钮组 |
|
|
58
|
+
| `moreIcon` | 更多图标插槽 |
|
|
59
|
+
|
|
60
|
+
## 3. 例子 (Examples)
|
|
61
|
+
|
|
62
|
+
## 代码演示
|
|
63
|
+
|
|
64
|
+
### 基础用法
|
|
65
|
+
slot扩展
|
|
66
|
+
* label item的标签
|
|
67
|
+
* default item的内容
|
|
68
|
+
```html
|
|
69
|
+
<fox-item>
|
|
70
|
+
<template v-slot:label>标签</template>
|
|
71
|
+
<template v-slot:default>
|
|
72
|
+
<input class="my-input" type="text" />
|
|
73
|
+
</template>
|
|
74
|
+
</fox-item>
|
|
75
|
+
```
|
|
76
|
+
### 必输标志
|
|
77
|
+
```html
|
|
78
|
+
<fox-item :is-required="true">
|
|
79
|
+
<template v-slot:label>标签</template>
|
|
80
|
+
<template v-slot:default>
|
|
81
|
+
<input class="my-input" type="text" />
|
|
82
|
+
</template>
|
|
83
|
+
</fox-item>
|
|
84
|
+
```
|
|
85
|
+
### TIP提示
|
|
86
|
+
* error-tip 错误提示
|
|
87
|
+
* warn-tip 警告提示
|
|
88
|
+
* info-tip 信息提示
|
|
89
|
+
```html
|
|
90
|
+
<fox-item error-tip="必输" :is-required="true">
|
|
91
|
+
<template v-slot:label>标签</template>
|
|
92
|
+
<template v-slot:default>
|
|
93
|
+
<input class="my-input" type="text" />
|
|
94
|
+
</template>
|
|
95
|
+
</fox-item>
|
|
96
|
+
<fox-item warn-tip="格式错误">
|
|
97
|
+
<template v-slot:label>标签</template>
|
|
98
|
+
<template v-slot:default>
|
|
99
|
+
<input type="text" />
|
|
100
|
+
</template>
|
|
101
|
+
</fox-item>
|
|
102
|
+
<fox-item info-tip="注意事项">
|
|
103
|
+
<template v-slot:label>标签</template>
|
|
104
|
+
<template v-slot:default>
|
|
105
|
+
<input class="my-input" type="text" />
|
|
106
|
+
</template>
|
|
107
|
+
</fox-item>
|
|
108
|
+
```
|
|
109
|
+
### prepend与append扩展
|
|
110
|
+
```html
|
|
111
|
+
<fox-item>
|
|
112
|
+
<template v-slot:label>左标签</template>
|
|
113
|
+
<template v-slot:prepend>
|
|
114
|
+
<div class="my-prepend">
|
|
115
|
+
<fox-icon name="search" color="#fa2c19"></fox-icon>
|
|
116
|
+
</div>
|
|
117
|
+
</template>
|
|
118
|
+
<template v-slot:default>
|
|
119
|
+
<input type="text" class="fox-input" />
|
|
120
|
+
</template>
|
|
121
|
+
</fox-item>
|
|
122
|
+
<fox-item>
|
|
123
|
+
<template v-slot:label>右标签</template>
|
|
124
|
+
<template v-slot:append>
|
|
125
|
+
<div class="my-append">
|
|
126
|
+
<fox-icon name="dongdong" color="#fa2c19"></fox-icon>
|
|
127
|
+
</div>
|
|
128
|
+
</template>
|
|
129
|
+
<template v-slot:default>
|
|
130
|
+
<input type="text" class="fox-input" />
|
|
131
|
+
</template>
|
|
132
|
+
</fox-item>
|
|
133
|
+
```
|
|
134
|
+
### hint提示
|
|
135
|
+
```html
|
|
136
|
+
<fox-item hint-text="提示" hint-visible="true" hint-type="text">
|
|
137
|
+
<template v-slot:label>标签</template>
|
|
138
|
+
<template v-slot:default>
|
|
139
|
+
<input class="my-input" type="text" />
|
|
140
|
+
</template>
|
|
141
|
+
</fox-item>
|
|
142
|
+
```
|
|
143
|
+
### 行单元
|
|
144
|
+
`fox-row-item` 通过 `align` 属性设置对齐方式
|
|
145
|
+
默认占据一行,一般用于按钮和标题
|
|
146
|
+
```html
|
|
147
|
+
<fox-group column="3">
|
|
148
|
+
<fox-input-item v-model="name">姓名</fox-input-item>
|
|
149
|
+
<fox-date-item v-model="date">生日</fox-date-item>
|
|
150
|
+
<fox-select-item v-model="sex" :source="sourceForArray">性别</fox-select-item>
|
|
151
|
+
<fox-row-item :align="align">
|
|
152
|
+
<fox-button @click="setRowAlign('left')">左对齐</fox-button>
|
|
153
|
+
<fox-button @click="setRowAlign('center')">居中对齐</fox-button>
|
|
154
|
+
<fox-button @click="setRowAlign('right')">右对齐</fox-button>
|
|
155
|
+
</fox-row-item>
|
|
156
|
+
</fox-group>
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 按钮组单元
|
|
160
|
+
|
|
161
|
+
`fox-buttons-item` 用于按钮组布局,并且可以通过属性`max-isplay-count`控制可以显示的组件数量
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
<script lang="ts" setup>
|
|
165
|
+
// 新增
|
|
166
|
+
const onAdd = () => {
|
|
167
|
+
console.info('add')
|
|
168
|
+
}
|
|
169
|
+
// 更新
|
|
170
|
+
const onUpdate = () => {
|
|
171
|
+
console.info('update')
|
|
172
|
+
}
|
|
173
|
+
// 删除
|
|
174
|
+
const onDelete = () => {
|
|
175
|
+
console.info('delete')
|
|
176
|
+
}
|
|
177
|
+
// 撤回
|
|
178
|
+
const onRevocation = () => {
|
|
179
|
+
console.info('revocation')
|
|
180
|
+
}
|
|
181
|
+
</script>
|
|
182
|
+
|
|
183
|
+
<template>
|
|
184
|
+
<fox-group column="1">
|
|
185
|
+
<fox-buttons-item :max-display-count="3">
|
|
186
|
+
<fox-button @click="onAdd">增加</fox-button>
|
|
187
|
+
<fox-button @click="onUpdate">更新</fox-button>
|
|
188
|
+
<fox-button @click="onDelete">删除</fox-button>
|
|
189
|
+
<fox-button @click="onRevocation">撤回</fox-button>
|
|
190
|
+
</fox-buttons-item>
|
|
191
|
+
</fox-group>
|
|
192
|
+
</template>
|
|
193
|
+
|
|
194
|
+
<style lang="scss"></style>
|
|
195
|
+
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## 4. 相关组件 (Related Components)
|
|
199
|
+
- **fox-js**: 与 Item 配合使用的相关组件
|
|
200
|
+
- **fox-icon**: 与 Item 配合使用的相关组件
|
|
201
|
+
- **fox-input**: 与 Item 配合使用的相关组件
|
|
202
|
+
- **fox-row-item**: 与 Item 配合使用的相关组件
|
|
203
|
+
- **fox-group**: 与 Item 配合使用的相关组件
|
|
204
|
+
- **fox-input-item**: 与 Item 配合使用的相关组件
|
|
205
|
+
- **fox-date-item**: 与 Item 配合使用的相关组件
|
|
206
|
+
- **fox-select-item**: 与 Item 配合使用的相关组件
|
|
207
|
+
|