@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,178 @@
|
|
|
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: CountUp 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 数字滚动组件,动态变化展示
|
|
12
|
+
tags: [foxui, fox-count-up, FoxCountUp]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-countup","fox-button"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# CountUp 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
CountUp 是 foxui 中用于 **数字滚动组件,动态变化展示** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-count-up` 进行了二次封装 (若为纯自研组件则填 "自定义开发")
|
|
23
|
+
- **核心增强**: 基于 NutUI 组件二次封装、支持禁用/只读状态、适配 H5 与小程序多端
|
|
24
|
+
- **适用场景**: 数字滚动组件,动态变化展示
|
|
25
|
+
|
|
26
|
+
> 💡 **关键原则**: 在所有 数字滚动组件,动态变化展示 中,**必须**优先使用此组件,禁止直接使用原生 NutUI 组件。
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## 2. 关键 API 说明 (Key API)
|
|
31
|
+
|
|
32
|
+
### 2.1 Props 属性
|
|
33
|
+
|
|
34
|
+
| 属性名 | 类型 | 必填 | 默认值 | 说明 |
|
|
35
|
+
| :--- | :--- | :---: | :---: | :--- |
|
|
36
|
+
| `init-num` | 初始数字 | Number | 0 |
|
|
37
|
+
| `end-num` | 结束数字 | Number | 0 |
|
|
38
|
+
| `speed` | 间隔数字,目前仅支持基本用法 | Number | 1 |
|
|
39
|
+
| `to-fixed` | 保留小数点后几位 | Number | 以传入的数字为准 |
|
|
40
|
+
| `start-flag` | 触发数字滚动的标识 | Boolean | true |
|
|
41
|
+
| `during` | 滚动一次运行时间 | Number | 1000 |
|
|
42
|
+
| `num-width` | 数字宽度,常用于自定义无缝滚动 | Number | 20 |
|
|
43
|
+
| `num-height` | 数字高度,常用于自定义无缝滚动(抽奖功能必传) | Number | 20 |
|
|
44
|
+
| `scrolling` | 用于数字滚动展示 | Boolean | false |
|
|
45
|
+
| `custom` | 用于自定义图片数字滚动 | Boolean | false |
|
|
46
|
+
| `custom-change-num` | 要变化的数字(用于自定义图片,initNum\endNum在此无效) | Number | 1 |
|
|
47
|
+
| `custom-bg-img` | 自定义图片(建议使用雪碧图实现,使用抽奖功能必须使用雪碧图) | - | - |
|
|
48
|
+
| `custom-spac-num` | 图片中数字之间可能会存在间距 | Number | 0 |
|
|
49
|
+
| `type` | 使用抽奖功能必传“machine” | string | '' |
|
|
50
|
+
| `machine-prize-num` | 奖品个数,一共多少个奖品,必传 | number | 4 |
|
|
51
|
+
| `machine-num` | 抽奖位,即滚动几个,必传 | number | 3 |
|
|
52
|
+
| `machine-prize-level` | 中奖图标,图标在雪碧图中的位置 | number | 0 |
|
|
53
|
+
| `machine-trun-more` | 滚动圈数 | number | 0 |
|
|
54
|
+
|
|
55
|
+
### 2.2 Events 事件
|
|
56
|
+
|
|
57
|
+
| 事件名 | 类型 | 说明 |
|
|
58
|
+
| :--- | :--- | :--- |
|
|
59
|
+
| `scroll-end` | 滚动结束后回调函数 | - |
|
|
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
|
+
```html
|
|
80
|
+
<fox-countup :init-num='0' :end-num='200'></fox-countup>
|
|
81
|
+
|
|
82
|
+
<fox-countup :init-num='150.00' :end-num='0.00' :speed='2.62' :to-fixed='2'></fox-countup>
|
|
83
|
+
|
|
84
|
+
<fox-countup :init-num='1000.00' :end-num='0.00' :speed='6.3' :start-flag='startNum' :to-fixed='2'></fox-countup>
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## 数字滚动
|
|
88
|
+
|
|
89
|
+
```html
|
|
90
|
+
<fox-countup :scrolling="true" :init-num='17.618' :during="600"></fox-countup>
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## 自定义数字图片展示
|
|
94
|
+
|
|
95
|
+
```html
|
|
96
|
+
<fox-countup
|
|
97
|
+
:custom-change-num="customNumber"
|
|
98
|
+
:custom-bg-img="bgImage"
|
|
99
|
+
:custom-spac-num="11"
|
|
100
|
+
:num-width="33"
|
|
101
|
+
:num-height="47"
|
|
102
|
+
:during="5000"
|
|
103
|
+
>
|
|
104
|
+
</fox-countup>
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
```javascript
|
|
108
|
+
export default {
|
|
109
|
+
data() {
|
|
110
|
+
return {
|
|
111
|
+
customNumber: 618,
|
|
112
|
+
bgImage: './demo/img/countup-number.png'
|
|
113
|
+
};
|
|
114
|
+
},
|
|
115
|
+
methods: {
|
|
116
|
+
run() {
|
|
117
|
+
let timer = null;
|
|
118
|
+
timer = setInterval(() => {
|
|
119
|
+
this.customNumber = Math.floor(Math.random() * (700 - 100 + 1) + 100);
|
|
120
|
+
}, 5000);
|
|
121
|
+
}
|
|
122
|
+
},
|
|
123
|
+
mounted() {
|
|
124
|
+
this.run();
|
|
125
|
+
}
|
|
126
|
+
};
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
## 抽奖
|
|
130
|
+
|
|
131
|
+
```html
|
|
132
|
+
<fox-countup
|
|
133
|
+
ref="countup-machine"
|
|
134
|
+
type="machine"
|
|
135
|
+
:machine-num="machineNum"
|
|
136
|
+
:machine-prize-num="5"
|
|
137
|
+
:machine-prize-level="prizeLevel"
|
|
138
|
+
:custom-bg-img="bgImage"
|
|
139
|
+
:num-width="100"
|
|
140
|
+
:num-height="100"
|
|
141
|
+
:during="3000"
|
|
142
|
+
@scroll-end="scrollAniEnd"
|
|
143
|
+
>
|
|
144
|
+
</fox-countup>
|
|
145
|
+
<fox-button @click="startRole" :disabled="startFlag">抽奖</fox-button>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
```javascript
|
|
149
|
+
export default {
|
|
150
|
+
data() {
|
|
151
|
+
return {
|
|
152
|
+
startFlag: false,
|
|
153
|
+
machineNum: 3,
|
|
154
|
+
bgImage: './demo/img/countup-icon.png',
|
|
155
|
+
prizeLevel: 0
|
|
156
|
+
};
|
|
157
|
+
},
|
|
158
|
+
methods: {
|
|
159
|
+
startRole() {
|
|
160
|
+
this.prizeLevel = Math.floor(Math.random() * 5 + 1);
|
|
161
|
+
this.startFlag = true;
|
|
162
|
+
this.$refs['countup-machine'].machineLuck();
|
|
163
|
+
},
|
|
164
|
+
scrollAniEnd() {
|
|
165
|
+
this.$toast.text('恭喜中奖!!!');
|
|
166
|
+
setTimeout(() => {
|
|
167
|
+
this.startFlag = false;
|
|
168
|
+
}, 300);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
## 4. 相关组件 (Related Components)
|
|
175
|
+
- **fox-js**: 与 CountUp 配合使用的相关组件
|
|
176
|
+
- **fox-countup**: 与 CountUp 配合使用的相关组件
|
|
177
|
+
- **fox-button**: 与 CountUp 配合使用的相关组件
|
|
178
|
+
|
|
@@ -0,0 +1,437 @@
|
|
|
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: DateItem 组件使用规范
|
|
9
|
+
impact: HIGH
|
|
10
|
+
type: capability
|
|
11
|
+
description: 日期组件
|
|
12
|
+
tags: [foxui, fox-date-item, FoxDateItem]
|
|
13
|
+
version: "4.0.0"
|
|
14
|
+
author: jiangcheng
|
|
15
|
+
related: ["fox-js","fox-group","fox-button"]
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# DateItem 组件使用规范
|
|
19
|
+
|
|
20
|
+
## 1. 核心职责 (Core Responsibility)
|
|
21
|
+
DateItem 是 foxui 中用于 **日期组件** 的标准组件。
|
|
22
|
+
- **基于**: NutUI `nut-date-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
|
+
| `date` | 日期类型(YYYY-MM-DD) |
|
|
37
|
+
| `datetime` | 日期时间类型(YYYY-MM-DD HH:mm:ss) |
|
|
38
|
+
| `time` | 时间类型(HH:mm:ss) |
|
|
39
|
+
| `year-month` | 年月类型(YYYY-MM) |
|
|
40
|
+
| `month-day` | 月天类型(MM-DD) |
|
|
41
|
+
| `hour-minute` | 时分类型(HH-mm) |
|
|
42
|
+
| `datehour` | 带小时的日期类型(YYYY-MM-DD HH) |
|
|
43
|
+
|
|
44
|
+
### 2.2 Events 事件
|
|
45
|
+
|
|
46
|
+
| 事件名 | 类型 | 说明 |
|
|
47
|
+
| :--- | :--- | :--- |
|
|
48
|
+
| `change` | 输入内容时触发 | val ,event |
|
|
49
|
+
| `focus` | 聚焦时触发 | val ,event |
|
|
50
|
+
| `blur` | 失焦时触发 | val ,event |
|
|
51
|
+
| `clear` | 点击清空时触发 | val |
|
|
52
|
+
|
|
53
|
+
### 2.3 Methods 方法
|
|
54
|
+
|
|
55
|
+
| 方法名 | 参数 | 说明 |
|
|
56
|
+
| :--- | :--- | :--- |
|
|
57
|
+
无
|
|
58
|
+
|
|
59
|
+
### 2.4 Slots 插槽
|
|
60
|
+
|
|
61
|
+
| 插槽名 | 说明 |
|
|
62
|
+
| :--- | :--- |
|
|
63
|
+
| `default` | 输入框标签内容 |
|
|
64
|
+
| `prepend` | 输入框左侧内容 |
|
|
65
|
+
| `append` | 输入框右侧内容 |
|
|
66
|
+
| `top` | 弹出选择框顶部内容 |
|
|
67
|
+
| `bottom` | 弹出选择框底部内容 |
|
|
68
|
+
|
|
69
|
+
## 3. 例子 (Examples)
|
|
70
|
+
|
|
71
|
+
## 代码演示
|
|
72
|
+
### date类型
|
|
73
|
+
```html
|
|
74
|
+
<fox-date-item v-model="val">日期框</fox-date-item>
|
|
75
|
+
<fox-date-item v-model="val2" :min-date="minDate" :max-date="maxDate" :value-format="formatTemplates.date">value格式化</fox-date-item>
|
|
76
|
+
<fox-date-item v-model="val3" :value-format="formatTemplates.date" :format="formatTemplates.textDate">text格式化</fox-date-item>
|
|
77
|
+
```
|
|
78
|
+
```javascript
|
|
79
|
+
export default createDemo({
|
|
80
|
+
// setup
|
|
81
|
+
setup() {
|
|
82
|
+
// 通用Format
|
|
83
|
+
const formatTemplates: Record<string, string> = {
|
|
84
|
+
date: 'YYYY-MM-DD',
|
|
85
|
+
textDate: 'YYYY年MM月DD日',
|
|
86
|
+
datetime: 'YYYY-MM-DD HH:mm:ss',
|
|
87
|
+
textDatetime: 'YYYY/MM/DD HH:mm:ss',
|
|
88
|
+
time: 'HH:mm:ss',
|
|
89
|
+
['month-day']: 'MM-DD',
|
|
90
|
+
datehour: 'YYYY年MM月DD日 HH时'
|
|
91
|
+
}
|
|
92
|
+
const tody = new Date()
|
|
93
|
+
// 数据
|
|
94
|
+
const data = reactive({
|
|
95
|
+
minDate: new Date(2010, 0, 1),
|
|
96
|
+
maxDate: new Date(2050, 11, 31),
|
|
97
|
+
val: tody,
|
|
98
|
+
val2: DateUtils.format(tody, formatTemplates.date),
|
|
99
|
+
val3: '',
|
|
100
|
+
})
|
|
101
|
+
watch(
|
|
102
|
+
() => data.val,
|
|
103
|
+
newVal => {
|
|
104
|
+
console.info('val', newVal)
|
|
105
|
+
}
|
|
106
|
+
)
|
|
107
|
+
watch(
|
|
108
|
+
() => data.val2,
|
|
109
|
+
newVal => {
|
|
110
|
+
console.info('val2', newVal)
|
|
111
|
+
}
|
|
112
|
+
)
|
|
113
|
+
watch(
|
|
114
|
+
() => data.val3,
|
|
115
|
+
newVal => {
|
|
116
|
+
console.info('val3', newVal)
|
|
117
|
+
}
|
|
118
|
+
)
|
|
119
|
+
watch(
|
|
120
|
+
() => data.val10,
|
|
121
|
+
newVal => {
|
|
122
|
+
console.info('val10', newVal)
|
|
123
|
+
}
|
|
124
|
+
)
|
|
125
|
+
return {
|
|
126
|
+
formatTemplates,
|
|
127
|
+
...toRefs(data)
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
})
|
|
131
|
+
```
|
|
132
|
+
### datetime类型
|
|
133
|
+
```html
|
|
134
|
+
<fox-date-item type="datetime" v-model="val4">日期时间框</fox-date-item>
|
|
135
|
+
<fox-date-item type="datetime" v-model="val5" :min-date="minDate" :max-date="maxDate" :value-format="formatTemplates.datetime">value格式化</fox-date-item>
|
|
136
|
+
<fox-date-item type="datetime" v-model="val6" :value-format="formatTemplates.datetime" :format="formatTemplates.textDatetime">text格式化</fox-date-item>
|
|
137
|
+
```
|
|
138
|
+
```javascript
|
|
139
|
+
export default createDemo({
|
|
140
|
+
// setup
|
|
141
|
+
setup() {
|
|
142
|
+
// 通用Format
|
|
143
|
+
const formatTemplates: Record<string, string> = {
|
|
144
|
+
date: 'YYYY-MM-DD',
|
|
145
|
+
textDate: 'YYYY年MM月DD日',
|
|
146
|
+
datetime: 'YYYY-MM-DD HH:mm:ss',
|
|
147
|
+
textDatetime: 'YYYY/MM/DD HH:mm:ss',
|
|
148
|
+
time: 'HH:mm:ss',
|
|
149
|
+
['month-day']: 'MM-DD',
|
|
150
|
+
datehour: 'YYYY年MM月DD日 HH时'
|
|
151
|
+
}
|
|
152
|
+
const tody = new Date()
|
|
153
|
+
// 数据
|
|
154
|
+
const data = reactive({
|
|
155
|
+
minDate: new Date(2010, 0, 1),
|
|
156
|
+
maxDate: new Date(2050, 11, 31),
|
|
157
|
+
val4: new Date(2020, 0, 1),
|
|
158
|
+
val5: '',
|
|
159
|
+
val6: '',
|
|
160
|
+
})
|
|
161
|
+
return {
|
|
162
|
+
formatTemplates,
|
|
163
|
+
...toRefs(data)
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
})
|
|
167
|
+
```
|
|
168
|
+
### time类型
|
|
169
|
+
```html
|
|
170
|
+
<fox-date-item type="time" v-model="val7" :value-format="formatTemplates.time" title="时间选择" :min-date="minDate" :max-date="maxDate">时间框</fox-date-item>
|
|
171
|
+
<fox-date-item type="time" v-model="val8" :value-format="formatTemplates.time" title="时间选择" :min-date="minDate" :minute-step="5" :max-date="maxDate">步长时间框</fox-date-item>
|
|
172
|
+
```
|
|
173
|
+
```javascript
|
|
174
|
+
export default createDemo({
|
|
175
|
+
// setup
|
|
176
|
+
setup() {
|
|
177
|
+
// 通用Format
|
|
178
|
+
const formatTemplates: Record<string, string> = {
|
|
179
|
+
date: 'YYYY-MM-DD',
|
|
180
|
+
textDate: 'YYYY年MM月DD日',
|
|
181
|
+
datetime: 'YYYY-MM-DD HH:mm:ss',
|
|
182
|
+
textDatetime: 'YYYY/MM/DD HH:mm:ss',
|
|
183
|
+
time: 'HH:mm:ss',
|
|
184
|
+
['month-day']: 'MM-DD',
|
|
185
|
+
datehour: 'YYYY年MM月DD日 HH时'
|
|
186
|
+
}
|
|
187
|
+
const tody = new Date()
|
|
188
|
+
// 数据
|
|
189
|
+
const data = reactive({
|
|
190
|
+
minDate: new Date(2010, 0, 1),
|
|
191
|
+
maxDate: new Date(2050, 11, 31),
|
|
192
|
+
val7: '',
|
|
193
|
+
val8: '',
|
|
194
|
+
})
|
|
195
|
+
return {
|
|
196
|
+
formatTemplates,
|
|
197
|
+
...toRefs(data)
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
})
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### year-month类型
|
|
204
|
+
|
|
205
|
+
```html
|
|
206
|
+
<fox-group title="year-month类型" label-width="120px">
|
|
207
|
+
<fox-date-item type="year-month" v-model="data.val8" :value-format="formatTemplates['year-month']" title="时间选择"
|
|
208
|
+
>时间选择</fox-date-item
|
|
209
|
+
>
|
|
210
|
+
</fox-group>
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
```javascript
|
|
214
|
+
export default createDemo({
|
|
215
|
+
// setup
|
|
216
|
+
setup() {
|
|
217
|
+
// 通用Format
|
|
218
|
+
const formatTemplates: Record<string, string> = {
|
|
219
|
+
date: 'YYYY-MM-DD',
|
|
220
|
+
textDate: 'YYYY年MM月DD日',
|
|
221
|
+
datetime: 'YYYY-MM-DD HH:mm:ss',
|
|
222
|
+
textDatetime: 'YYYY/MM/DD HH:mm:ss',
|
|
223
|
+
time: 'HH:mm:ss',
|
|
224
|
+
['year-month']: 'YY-MM',
|
|
225
|
+
['month-day']: 'MM-DD',
|
|
226
|
+
datehour: 'YYYY年MM月DD日 HH时'
|
|
227
|
+
}
|
|
228
|
+
const tody = new Date()
|
|
229
|
+
// 数据
|
|
230
|
+
const data = reactive({
|
|
231
|
+
minDate: new Date(2010, 0, 1),
|
|
232
|
+
maxDate: new Date(2050, 11, 31),
|
|
233
|
+
val8: ''
|
|
234
|
+
})
|
|
235
|
+
return {
|
|
236
|
+
formatTemplates,
|
|
237
|
+
...toRefs(data)
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
})
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
|
|
245
|
+
|
|
246
|
+
### month-day类型
|
|
247
|
+
```html
|
|
248
|
+
<fox-date-item type="month-day" v-model="val9" :value-format="formatTemplates['month-day']" title="时间选择">时间选择</fox-date-item>
|
|
249
|
+
```
|
|
250
|
+
```javascript
|
|
251
|
+
export default createDemo({
|
|
252
|
+
// setup
|
|
253
|
+
setup() {
|
|
254
|
+
// 通用Format
|
|
255
|
+
const formatTemplates: Record<string, string> = {
|
|
256
|
+
date: 'YYYY-MM-DD',
|
|
257
|
+
textDate: 'YYYY年MM月DD日',
|
|
258
|
+
datetime: 'YYYY-MM-DD HH:mm:ss',
|
|
259
|
+
textDatetime: 'YYYY/MM/DD HH:mm:ss',
|
|
260
|
+
time: 'HH:mm:ss',
|
|
261
|
+
['year-month']: 'YY-MM',
|
|
262
|
+
['month-day']: 'MM-DD',
|
|
263
|
+
datehour: 'YYYY年MM月DD日 HH时'
|
|
264
|
+
}
|
|
265
|
+
const tody = new Date()
|
|
266
|
+
// 数据
|
|
267
|
+
const data = reactive({
|
|
268
|
+
minDate: new Date(2010, 0, 1),
|
|
269
|
+
maxDate: new Date(2050, 11, 31),
|
|
270
|
+
val9: ''
|
|
271
|
+
})
|
|
272
|
+
return {
|
|
273
|
+
formatTemplates,
|
|
274
|
+
...toRefs(data)
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
})
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### datehour类型
|
|
281
|
+
```html
|
|
282
|
+
<fox-date-item type="datehour" v-model="val10" :value-format="formatTemplates['datehour']" title="时间选择">时间选择</fox-date-item>
|
|
283
|
+
```
|
|
284
|
+
```javascript
|
|
285
|
+
export default createDemo({
|
|
286
|
+
// setup
|
|
287
|
+
setup() {
|
|
288
|
+
// 通用Format
|
|
289
|
+
const formatTemplates: Record<string, string> = {
|
|
290
|
+
date: 'YYYY-MM-DD',
|
|
291
|
+
textDate: 'YYYY年MM月DD日',
|
|
292
|
+
datetime: 'YYYY-MM-DD HH:mm:ss',
|
|
293
|
+
textDatetime: 'YYYY/MM/DD HH:mm:ss',
|
|
294
|
+
time: 'HH:mm:ss',
|
|
295
|
+
['month-day']: 'MM-DD',
|
|
296
|
+
datehour: 'YYYY年MM月DD日 HH时'
|
|
297
|
+
}
|
|
298
|
+
const tody = new Date()
|
|
299
|
+
// 数据
|
|
300
|
+
const data = reactive({
|
|
301
|
+
minDate: new Date(2010, 0, 1),
|
|
302
|
+
maxDate: new Date(2050, 11, 31),
|
|
303
|
+
val10: ''
|
|
304
|
+
})
|
|
305
|
+
watch(
|
|
306
|
+
() => data.val10,
|
|
307
|
+
newVal => {
|
|
308
|
+
console.info('val10', newVal)
|
|
309
|
+
}
|
|
310
|
+
)
|
|
311
|
+
return {
|
|
312
|
+
formatTemplates,
|
|
313
|
+
...toRefs(data)
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
})
|
|
317
|
+
```
|
|
318
|
+
|
|
319
|
+
### 自定义按钮
|
|
320
|
+
```html
|
|
321
|
+
<fox-date-item ref="dateRef" v-model="data.val11">
|
|
322
|
+
<template v-slot:default>日期框</template>
|
|
323
|
+
<template v-slot:bottom>
|
|
324
|
+
<fox-button block type="primary" @click="clearFunc">清空</fox-button>
|
|
325
|
+
</template>
|
|
326
|
+
</fox-date-item>
|
|
327
|
+
|
|
328
|
+
```
|
|
329
|
+
```javascript
|
|
330
|
+
|
|
331
|
+
<script lang="ts" setup>
|
|
332
|
+
import { reactive, watch, ref } from 'vue'
|
|
333
|
+
|
|
334
|
+
const data = reactive({
|
|
335
|
+
val12:''
|
|
336
|
+
})
|
|
337
|
+
|
|
338
|
+
const dateRef = ref<any>()
|
|
339
|
+
const clearFunc = () => {
|
|
340
|
+
data.val11 = ''
|
|
341
|
+
dateRef.value?.hidePicker()
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
</script>
|
|
345
|
+
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
### 样式设置
|
|
350
|
+
|
|
351
|
+
通过属性`three-dimensional`可设置是否开启3D效果
|
|
352
|
+
|
|
353
|
+
```html
|
|
354
|
+
<fox-date-item v-model="data.val14" :three-dimensional="false" :visible-item-count="13">平铺</fox-date-item>
|
|
355
|
+
|
|
356
|
+
```
|
|
357
|
+
```javascript
|
|
358
|
+
|
|
359
|
+
<script lang="ts" setup>
|
|
360
|
+
import { reactive, watch, ref } from 'vue'
|
|
361
|
+
|
|
362
|
+
const data = reactive({
|
|
363
|
+
val14:''
|
|
364
|
+
})
|
|
365
|
+
|
|
366
|
+
</script>
|
|
367
|
+
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### item格式化
|
|
371
|
+
|
|
372
|
+
通过属性`dateItem-formatter`格式化picker item的格式
|
|
373
|
+
|
|
374
|
+
```html
|
|
375
|
+
<fox-date-item v-model="data.val15" :is-show-chinese="false" :item-formatter="dateItemFormatter">格式化</fox-date-item>
|
|
376
|
+
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
```javascript
|
|
380
|
+
|
|
381
|
+
<script lang="ts" setup>
|
|
382
|
+
import { reactive, watch, ref } from 'vue'
|
|
383
|
+
|
|
384
|
+
const data = reactive({
|
|
385
|
+
val15:''
|
|
386
|
+
})
|
|
387
|
+
|
|
388
|
+
// date item formatter
|
|
389
|
+
const dateItemFormatter = (option: Record<string, any>): void => {
|
|
390
|
+
if (option.type === 'year') {
|
|
391
|
+
option.text = `${option.text} 年`
|
|
392
|
+
} else if (option.type === 'month') {
|
|
393
|
+
option.text = `${option.text} 月`
|
|
394
|
+
} else if (option.type === 'day') {
|
|
395
|
+
option.text = `${option.text} 日`
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
</script>
|
|
400
|
+
|
|
401
|
+
```
|
|
402
|
+
|
|
403
|
+
### item过滤
|
|
404
|
+
|
|
405
|
+
通过属性`dateItem-filter`可以过滤那些item可显示,返回`false`代表不显示
|
|
406
|
+
|
|
407
|
+
```html
|
|
408
|
+
<fox-date-item v-model="data.val16" :item-filter="dateItemFilter">格式化</fox-date-item>
|
|
409
|
+
|
|
410
|
+
```
|
|
411
|
+
|
|
412
|
+
```javascript
|
|
413
|
+
|
|
414
|
+
<script lang="ts" setup>
|
|
415
|
+
import { reactive, watch, ref } from 'vue'
|
|
416
|
+
|
|
417
|
+
const data = reactive({
|
|
418
|
+
val16:''
|
|
419
|
+
})
|
|
420
|
+
|
|
421
|
+
// date item filter(只显示偶数的年份)
|
|
422
|
+
const dateItemFilter = (option: Record<string, any>): boolean => {
|
|
423
|
+
if (option.type === 'year') {
|
|
424
|
+
return option.value % 2 === 0
|
|
425
|
+
}
|
|
426
|
+
return true
|
|
427
|
+
}
|
|
428
|
+
|
|
429
|
+
</script>
|
|
430
|
+
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
## 4. 相关组件 (Related Components)
|
|
434
|
+
- **fox-js**: 与 DateItem 配合使用的相关组件
|
|
435
|
+
- **fox-group**: 与 DateItem 配合使用的相关组件
|
|
436
|
+
- **fox-button**: 与 DateItem 配合使用的相关组件
|
|
437
|
+
|