@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,75 @@
|
|
|
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: Image 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 图片展示
|
|
12
|
+
tags: [foxui, fox-image, FoxImage]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Image 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
Image 是 foxui 中用于 **图片展示** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-image` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、支持插槽扩展自定义内容
|
|
24
|
+
- **适用场景**: 图片展示
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 图片展示 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `src` | 图片链接 | String | - |
|
|
37
|
+
| `fit` | 图片填充模式,等同于原生的 object-fit 属性 | ImageFit | 'fill' |
|
|
38
|
+
| `position` | 图片位置,等同于原生的 object-position 属性 | ImagePosition | 'center' |
|
|
39
|
+
| `alt` | 替代文本 | String | - |
|
|
40
|
+
| `width` | 宽度,默认单位px | String | - |
|
|
41
|
+
| `height` | 高度,默认单位px | String | - |
|
|
42
|
+
| `round` | 是否显示为圆角 | Boolean | false |
|
|
43
|
+
| `radius` | 圆角大小 | String \ | Numer |
|
|
44
|
+
| `show-error` | 是否展示图片加载失败 | Boolean | false |
|
|
45
|
+
| `show-loading` | 是否展示加载中图片 | Boolean | true |
|
|
46
|
+
| `lazy-load` | 懒加载 | boolean | false |
|
|
47
|
+
|
|
48
|
+
### 2.2 Events 事件
|
|
49
|
+
|
|
50
|
+
| 事件名 | 类型 | 说明 |
|
|
51
|
+
| :--- | :--- | :--- |
|
|
52
|
+
| `click` | 点击图片时触发 | event: Event |
|
|
53
|
+
| `load` | 图片加载完后触发 | -- |
|
|
54
|
+
| `error` | 图片加载失败后触发 | -- |
|
|
55
|
+
|
|
56
|
+
### 2.3 Methods 方法
|
|
57
|
+
|
|
58
|
+
| 方法名 | 参数 | 说明 |
|
|
59
|
+
| :--- | :--- | :--- |
|
|
60
|
+
无
|
|
61
|
+
|
|
62
|
+
### 2.4 Slots 插槽
|
|
63
|
+
|
|
64
|
+
| 插槽名 | 说明 |
|
|
65
|
+
| :--- | :--- |
|
|
66
|
+
| `loading` | 自定义加载中的提示内容 |
|
|
67
|
+
| `error` | 自定义记载失败的提示内容 |
|
|
68
|
+
|
|
69
|
+
## 3. 例子 (Examples)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
## 4. 相关组件 (Related Components)
|
|
74
|
+
- **fox-js**: 与 Image 配合使用的相关组件
|
|
75
|
+
|
|
@@ -0,0 +1,79 @@
|
|
|
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: ImagePreview 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 图片预览
|
|
12
|
+
tags: [foxui, fox-image-preview, FoxImagePreview]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-cell"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# ImagePreview 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
ImagePreview 是 foxui 中用于 **图片预览** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-image-preview` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、适配 H5 与小程序多端、支持插槽扩展自定义内容
|
|
24
|
+
- **适用场景**: 图片预览
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 图片预览 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `show` | 是否展示预览图片 | Boolean | false |
|
|
37
|
+
| `videos` | 预览的视频数组(视频自动放到图片之前、taro场景暂不支持) | Array<Object> | |
|
|
38
|
+
| `images` | 预览图片数组 | Array<String> | |
|
|
39
|
+
| `autoplay` | 自动轮播时长,0表示不会自动轮播 | Number、String | 3000 |
|
|
40
|
+
| `init-no` | 初始页码 | Number | 1 |
|
|
41
|
+
| `pagination-visible` | 分页指示器是否展示 | Boolean | false |
|
|
42
|
+
| `pagination-color` | 分页指示器选中的颜色 | String | 'fff' |
|
|
43
|
+
| `content-close` | 点击图片可以退出预览 | Boolean | false |
|
|
44
|
+
| `show-index` | 是否显示页码 | Boolean | true |
|
|
45
|
+
| `closeable` | 是否显示关闭图标 | Boolean | false |
|
|
46
|
+
| `close-icon` | 关闭图片名称或图片链接 | String | ‘circle-close’ |
|
|
47
|
+
| `close-icon-position` | 关闭图标位置,可选值:top-left | String | ‘top-right’ |
|
|
48
|
+
| `before-close` | 关闭前的回调函数,返回 false 可阻止关闭,支持返回 Promise | active: number => boolean | Promise<boolean> |
|
|
49
|
+
| `max-zoom` | 手势缩放时,最大缩放比例 | number | 3 |
|
|
50
|
+
| `min-zoom` | 手势缩放时,最小缩放比例 | number | 1/3 |
|
|
51
|
+
| `is-loop` | 是否循环播放 | boolean | true |
|
|
52
|
+
|
|
53
|
+
### 2.2 Events 事件
|
|
54
|
+
|
|
55
|
+
| 事件名 | 类型 | 说明 |
|
|
56
|
+
| :--- | :--- | :--- |
|
|
57
|
+
| `close` | 点击遮罩关闭图片预览时触发 | 无 |
|
|
58
|
+
| `change` | 切换图片时触发 | index:当前图片索引 |
|
|
59
|
+
|
|
60
|
+
### 2.3 Methods 方法
|
|
61
|
+
|
|
62
|
+
| 方法名 | 参数 | 说明 |
|
|
63
|
+
| :--- | :--- | :--- |
|
|
64
|
+
无
|
|
65
|
+
|
|
66
|
+
### 2.4 Slots 插槽
|
|
67
|
+
|
|
68
|
+
| 插槽名 | 说明 |
|
|
69
|
+
| :--- | :--- |
|
|
70
|
+
| `closeIcon` | 自定义关闭图片 |
|
|
71
|
+
|
|
72
|
+
## 3. 例子 (Examples)
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
## 4. 相关组件 (Related Components)
|
|
77
|
+
- **fox-js**: 与 ImagePreview 配合使用的相关组件
|
|
78
|
+
- **fox-cell**: 与 ImagePreview 配合使用的相关组件
|
|
79
|
+
|
|
@@ -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: Indicator 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 显示一个任务或流程的进度,常用语开通流程。
|
|
12
|
+
tags: [foxui, fox-indicator, FoxIndicator]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-cell","fox-row","fox-col","fox-button"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Indicator 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
Indicator 是 foxui 中用于 **显示一个任务或流程的进度,常用语开通流程。** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-indicator` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、适配 H5 与小程序多端、支持主题定制
|
|
24
|
+
- **适用场景**: 显示一个任务或流程的进度,常用语开通流程。
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 显示一个任务或流程的进度,常用语开通流程。 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `current` | 当前步骤 | number | 1 |
|
|
37
|
+
| `size` | 步骤长度 | number | 3 |
|
|
38
|
+
| `block` | 是否启用块级布局 | boolean | false |
|
|
39
|
+
| `align` | 对齐方式,仅在 block 为 true 时生效, 可选值 left, right, center | string | left |
|
|
40
|
+
| `fill-zero` | 单数前面是否补 0 | boolean | true |
|
|
41
|
+
|
|
42
|
+
### 2.2 Events 事件
|
|
43
|
+
|
|
44
|
+
| 事件名 | 类型 | 说明 |
|
|
45
|
+
| :--- | :--- | :--- |
|
|
46
|
+
无
|
|
47
|
+
|
|
48
|
+
### 2.3 Methods 方法
|
|
49
|
+
|
|
50
|
+
| 方法名 | 参数 | 说明 |
|
|
51
|
+
| :--- | :--- | :--- |
|
|
52
|
+
无
|
|
53
|
+
|
|
54
|
+
### 2.4 Slots 插槽
|
|
55
|
+
|
|
56
|
+
| 插槽名 | 说明 |
|
|
57
|
+
| :--- | :--- |
|
|
58
|
+
无
|
|
59
|
+
|
|
60
|
+
## 3. 例子 (Examples)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
## 4. 相关组件 (Related Components)
|
|
65
|
+
- **fox-js**: 与 Indicator 配合使用的相关组件
|
|
66
|
+
- **fox-cell**: 与 Indicator 配合使用的相关组件
|
|
67
|
+
- **fox-row**: 与 Indicator 配合使用的相关组件
|
|
68
|
+
- **fox-col**: 与 Indicator 配合使用的相关组件
|
|
69
|
+
- **fox-button**: 与 Indicator 配合使用的相关组件
|
|
70
|
+
|
|
@@ -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: InfiniteLoading 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 列表滚动到底部自动加载更多数据
|
|
12
|
+
tags: [foxui, fox-infinite-loading, FoxInfiniteLoading]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-tabs","fox-tab-pane"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# InfiniteLoading 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
InfiniteLoading 是 foxui 中用于 **列表滚动到底部自动加载更多数据** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-infinite-loading` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
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
|
+
| `has-more` | 是否还有更多数据 | boolean | true |
|
|
38
|
+
| `threshold` | 滚动条与底部距离小于 threshold 时触发 loadMore 事件 | number | 200 |
|
|
39
|
+
| `use-capture` | 是否使用捕获模式 true 捕获 false 冒泡 | boolean | false |
|
|
40
|
+
| `load-more-text` | “没有更多数据” 展示文案 | string | '哎呀,这里是底部了啦' |
|
|
41
|
+
| `load-text` | 上拉加载提示文案 | string | 加载中... |
|
|
42
|
+
| `immediate` | 是否立即执行加载方法,以防初始状态下内容无法撑满容 | boolean | false |
|
|
43
|
+
|
|
44
|
+
### 2.2 Events 事件
|
|
45
|
+
|
|
46
|
+
| 事件名 | 类型 | 说明 |
|
|
47
|
+
| :--- | :--- | :--- |
|
|
48
|
+
| `load-more` | 继续加载的回调函数 | - |
|
|
49
|
+
| `scroll-change` | 实时监听滚动高度 | 滚动高度 |
|
|
50
|
+
|
|
51
|
+
### 2.3 Methods 方法
|
|
52
|
+
|
|
53
|
+
| 方法名 | 参数 | 说明 |
|
|
54
|
+
| :--- | :--- | :--- |
|
|
55
|
+
无
|
|
56
|
+
|
|
57
|
+
### 2.4 Slots 插槽
|
|
58
|
+
|
|
59
|
+
| 插槽名 | 说明 |
|
|
60
|
+
| :--- | :--- |
|
|
61
|
+
| `default` | 自定义加载内容 |
|
|
62
|
+
| `loading` | 自定义底部加载中提示 |
|
|
63
|
+
| `loading-icon` | 自定义底部加载中图标 |
|
|
64
|
+
| `finished` | 自定义加载完成后的提示文案 |
|
|
65
|
+
|
|
66
|
+
## 3. 例子 (Examples)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
## 4. 相关组件 (Related Components)
|
|
71
|
+
- **fox-js**: 与 InfiniteLoading 配合使用的相关组件
|
|
72
|
+
- **fox-tabs**: 与 InfiniteLoading 配合使用的相关组件
|
|
73
|
+
- **fox-tab-pane**: 与 InfiniteLoading 配合使用的相关组件
|
|
74
|
+
|
|
@@ -0,0 +1,210 @@
|
|
|
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: InputItem 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 输入框组件
|
|
12
|
+
tags: [foxui, fox-input-item, FoxInputItem]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-icon","fox-button"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# InputItem 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
InputItem 是 foxui 中用于 **输入框组件** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-input-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
|
+
| `type` | 类型,可选值为 text number 等 | String | text |
|
|
38
|
+
| `placeholder` | 为空时占位符 | String | - |
|
|
39
|
+
| `max-length` | 限制最长输入字符 | String、Number | - |
|
|
40
|
+
| `clearable` | 展示清除icon | Boolean | true |
|
|
41
|
+
| `text-align` | 文本位置,可选值left,center,right | String | left |
|
|
42
|
+
| `unit` | 单位 | String | - |
|
|
43
|
+
| `label` | 标签 | String | - |
|
|
44
|
+
| `label-width` | 标签宽度 | String | - |
|
|
45
|
+
| `label-position` | 标签位置可选值left,right,top | String | - |
|
|
46
|
+
| `is-required` | 左侧号是否展示 | Boolean | false |
|
|
47
|
+
| `disabled` | 是否禁用 | Boolean | false |
|
|
48
|
+
| `readonly` | 是否只读 | Boolean | false |
|
|
49
|
+
| `error-tip` | 错误提示 | String | - |
|
|
50
|
+
| `error-icon` | 错误提示图标 | String | - |
|
|
51
|
+
| `warn-tip` | 警告提示 | String | - |
|
|
52
|
+
| `wran-icon` | 警告提示图标 | String | - |
|
|
53
|
+
| `info-tip` | 提示 | String | - |
|
|
54
|
+
| `info-icon` | 提示图标 | String | - |
|
|
55
|
+
| `adjust-position` | 键盘弹起时,是否自动上推页面(仅支持小程序) | Boolean | true |
|
|
56
|
+
| `always-system` | 是否强制使用系统键盘和 Web-view 创建的 input 元素。为 true 时,confirm-type、confirm-hold 可能失效(仅支持小程序) | Boolean | false |
|
|
57
|
+
|
|
58
|
+
### 2.2 Events 事件
|
|
59
|
+
|
|
60
|
+
| 事件名 | 类型 | 说明 |
|
|
61
|
+
| :--- | :--- | :--- |
|
|
62
|
+
| `change` | 输入内容时触发 | val ,event |
|
|
63
|
+
| `focus` | 聚焦时触发 | val ,event |
|
|
64
|
+
| `blur` | 失焦时触发 | val ,event |
|
|
65
|
+
| `clear` | 点击清空时触发 | val |
|
|
66
|
+
|
|
67
|
+
### 2.3 Methods 方法
|
|
68
|
+
|
|
69
|
+
| 方法名 | 参数 | 说明 |
|
|
70
|
+
| :--- | :--- | :--- |
|
|
71
|
+
无
|
|
72
|
+
|
|
73
|
+
### 2.4 Slots 插槽
|
|
74
|
+
|
|
75
|
+
| 插槽名 | 说明 |
|
|
76
|
+
| :--- | :--- |
|
|
77
|
+
| `default` | label内容 |
|
|
78
|
+
| `prepend` | 左侧自定义内容 |
|
|
79
|
+
| `append` | 右侧自定义内容 |
|
|
80
|
+
|
|
81
|
+
## 3. 例子 (Examples)
|
|
82
|
+
|
|
83
|
+
## 代码演示
|
|
84
|
+
### 基础用法
|
|
85
|
+
常用属性与事件
|
|
86
|
+
```html
|
|
87
|
+
<fox-input-item v-model="val" @change="onChange" @focus="onFocus" @blur="onBlur" @clear="onClear">文本</fox-input-item>
|
|
88
|
+
<fox-input-item v-model="val2" :is-required="m_required">必输</fox-input-item>
|
|
89
|
+
<fox-input-item v-model="val3" :is-required="m_required" unit="个" placeholder="请输入个数">单位</fox-input-item>
|
|
90
|
+
<fox-input-item v-model="val4" max-length="6" placeholder="请输入6位">限制6</fox-input-item>
|
|
91
|
+
<fox-input-item v-model="val5" :readonly="m_readonly">只读</fox-input-item>
|
|
92
|
+
<fox-input-item v-model="val6" :disabled="m_disabled">禁用</fox-input-item>
|
|
93
|
+
```
|
|
94
|
+
### 标签设置
|
|
95
|
+
```html
|
|
96
|
+
<fox-input-item v-model="val7" label-position="left" :is-required="m_required">left标签</fox-input-item>
|
|
97
|
+
<!-- <fox-input-item v-model="val8" label-position="right" :is-required="m_required" unit="元">right标签</fox-input-item> -->
|
|
98
|
+
<fox-input-item v-model="val9" label-position="top" :is-required="m_required" unit="元">top标签</fox-input-item>
|
|
99
|
+
<fox-input-item v-model="val10">
|
|
100
|
+
<template v-slot:default>
|
|
101
|
+
<view class="my-label">
|
|
102
|
+
<fox-icon name="star-n" size="12px" color="#fa2c19"> </fox-icon>
|
|
103
|
+
<span>标签</span>
|
|
104
|
+
</view>
|
|
105
|
+
</template>
|
|
106
|
+
</fox-input-item>
|
|
107
|
+
<fox-input-item v-model="val11" placeholder="无标签"> </fox-input-item>
|
|
108
|
+
```
|
|
109
|
+
### 插槽扩展
|
|
110
|
+
```html
|
|
111
|
+
<fox-input-item v-model="val12">
|
|
112
|
+
<template v-slot:default>左边</template>
|
|
113
|
+
<template v-slot:prepend>
|
|
114
|
+
<view class="my-prepend">
|
|
115
|
+
<fox-icon name="search" color="#fa2c19"></fox-icon>
|
|
116
|
+
</view>
|
|
117
|
+
</template>
|
|
118
|
+
</fox-input-item>
|
|
119
|
+
<fox-input-item v-model="val13">
|
|
120
|
+
<template v-slot:default>右边</template>
|
|
121
|
+
<template v-slot:append>
|
|
122
|
+
<view class="my-append">
|
|
123
|
+
<fox-icon name="dongdong" color="#4994df"></fox-icon>
|
|
124
|
+
</view>
|
|
125
|
+
</template>
|
|
126
|
+
</fox-input-item>
|
|
127
|
+
<fox-input-item v-model="val14">
|
|
128
|
+
<template v-slot:default>验证码</template>
|
|
129
|
+
<template v-slot:append>
|
|
130
|
+
<view class="my-append-button">
|
|
131
|
+
<fox-button shape="square" size="small">发送</fox-button>
|
|
132
|
+
</view>
|
|
133
|
+
</template>
|
|
134
|
+
</fox-input-item>
|
|
135
|
+
```
|
|
136
|
+
### 提示
|
|
137
|
+
```html
|
|
138
|
+
<fox-input-item v-model="val15" :is-required="true" error-tip="错误信息">错误</fox-input-item>
|
|
139
|
+
<fox-input-item v-model="val16" :is-required="true" warn-tip="警告信息">警告</fox-input-item>
|
|
140
|
+
<fox-input-item v-model="val17" :is-required="true" info-tip="提示信息">信息</fox-input-item>
|
|
141
|
+
```
|
|
142
|
+
### 自定义类型
|
|
143
|
+
```html
|
|
144
|
+
<fox-input-item v-model="val18" type="password" @change="onChange">密码</fox-input-item>
|
|
145
|
+
<fox-input-item v-model="val19" type="number" @change="onChange">整数</fox-input-item>
|
|
146
|
+
<fox-input-item v-model="val20" type="digit" placeholder="支持小数点的输入" @change="onChange">数字</fox-input-item>
|
|
147
|
+
```
|
|
148
|
+
### 代码
|
|
149
|
+
```ts
|
|
150
|
+
import { reactive, toRefs } from 'vue'
|
|
151
|
+
import { createComponent } from '@/utils/create'
|
|
152
|
+
const { createDemo } = createComponent('input')
|
|
153
|
+
export default createDemo({
|
|
154
|
+
// setup
|
|
155
|
+
setup() {
|
|
156
|
+
// 数据
|
|
157
|
+
const data = reactive({
|
|
158
|
+
val: '文本输入框',
|
|
159
|
+
val2: '',
|
|
160
|
+
val3: '',
|
|
161
|
+
val4: '',
|
|
162
|
+
val5: '只读文本',
|
|
163
|
+
val6: '禁用文本',
|
|
164
|
+
val7: '',
|
|
165
|
+
val8: '',
|
|
166
|
+
val9: '',
|
|
167
|
+
val10: '',
|
|
168
|
+
val11: '',
|
|
169
|
+
val12: '',
|
|
170
|
+
val13: '',
|
|
171
|
+
val14: '',
|
|
172
|
+
val15: '',
|
|
173
|
+
val16: '',
|
|
174
|
+
val17: '',
|
|
175
|
+
val18: '',
|
|
176
|
+
val19: '',
|
|
177
|
+
val20: '',
|
|
178
|
+
m_disabled: true,
|
|
179
|
+
m_readonly: true,
|
|
180
|
+
m_required: true
|
|
181
|
+
})
|
|
182
|
+
// 方法
|
|
183
|
+
const methods = {
|
|
184
|
+
onChange: (value: string | number, event: Event) => {
|
|
185
|
+
console.log('change: ', value, event)
|
|
186
|
+
},
|
|
187
|
+
onFocus: (value: string | number, event: Event) => {
|
|
188
|
+
console.log('focus:', value, event)
|
|
189
|
+
},
|
|
190
|
+
onBlur: (value: string | number, event: Event) => {
|
|
191
|
+
console.log('blur:', value, event)
|
|
192
|
+
},
|
|
193
|
+
onClear: (value: string | number) => {
|
|
194
|
+
console.log('clear:', value)
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
return {
|
|
198
|
+
...toRefs(data),
|
|
199
|
+
...methods
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
## 4. 相关组件 (Related Components)
|
|
207
|
+
- **fox-js**: 与 InputItem 配合使用的相关组件
|
|
208
|
+
- **fox-icon**: 与 InputItem 配合使用的相关组件
|
|
209
|
+
- **fox-button**: 与 InputItem 配合使用的相关组件
|
|
210
|
+
|