@xtdev/xt-miniprogram-ui 1.2.60 → 1.2.61
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/libs/package.json +1 -0
- package/libs/xt-button/README.md +60 -0
- package/libs/xt-button/index.js +116 -0
- package/libs/xt-button/index.json +7 -0
- package/libs/xt-button/index.wxml +31 -0
- package/libs/xt-button/index.wxss +70 -0
- package/libs/xt-card-cell/README.md +67 -0
- package/libs/xt-card-cell/index.js +43 -0
- package/libs/xt-card-cell/index.json +6 -0
- package/libs/xt-card-cell/index.wxml +34 -0
- package/libs/xt-card-cell/index.wxss +89 -0
- package/libs/xt-cell/README.md +41 -0
- package/libs/xt-cell/index.js +42 -0
- package/libs/xt-cell/index.json +7 -0
- package/libs/xt-cell/index.wxml +12 -0
- package/libs/xt-cell/index.wxss +50 -0
- package/libs/xt-date-picker/README.md +77 -0
- package/libs/xt-date-picker/index.js +443 -0
- package/libs/xt-date-picker/index.json +7 -0
- package/libs/xt-date-picker/index.wxml +58 -0
- package/libs/xt-date-picker/index.wxss +118 -0
- package/libs/xt-date-picker-loop/README.md +77 -0
- package/libs/xt-date-picker-loop/index.js +684 -0
- package/libs/xt-date-picker-loop/index.json +8 -0
- package/libs/xt-date-picker-loop/index.wxml +61 -0
- package/libs/xt-date-picker-loop/index.wxss +117 -0
- package/libs/xt-dialog/README.md +157 -0
- package/libs/xt-dialog/index.js +142 -0
- package/libs/xt-dialog/index.json +5 -0
- package/libs/xt-dialog/index.wxml +64 -0
- package/libs/xt-dialog/index.wxss +129 -0
- package/libs/xt-form/index.js +83 -0
- package/libs/xt-form/index.json +5 -0
- package/libs/xt-form/index.wxml +67 -0
- package/libs/xt-form/index.wxss +141 -0
- package/libs/xt-icon/README.md +39 -0
- package/libs/xt-icon/index.js +25 -0
- package/libs/xt-icon/index.json +5 -0
- package/libs/xt-icon/index.wxml +2 -0
- package/libs/xt-icon/index.wxss +159 -0
- package/libs/xt-popover/README.md +71 -0
- package/libs/xt-popover/index.js +209 -0
- package/libs/xt-popover/index.json +7 -0
- package/libs/xt-popover/index.wxml +43 -0
- package/libs/xt-popover/index.wxss +135 -0
- package/libs/xt-preview-image/README.md +46 -0
- package/libs/xt-preview-image/index.js +111 -0
- package/libs/xt-preview-image/index.json +4 -0
- package/libs/xt-preview-image/index.wxml +25 -0
- package/libs/xt-preview-image/index.wxss +82 -0
- package/libs/xt-search/README.md +55 -0
- package/libs/xt-search/index.js +88 -0
- package/libs/xt-search/index.json +7 -0
- package/libs/xt-search/index.wxml +17 -0
- package/libs/xt-search/index.wxss +82 -0
- package/libs/xt-stepper/README.md +52 -0
- package/libs/xt-stepper/index.js +158 -0
- package/libs/xt-stepper/index.json +5 -0
- package/libs/xt-stepper/index.wxml +11 -0
- package/libs/xt-stepper/index.wxss +77 -0
- package/libs/xt-steps/README.md +79 -0
- package/libs/xt-steps/index.js +37 -0
- package/libs/xt-steps/index.json +7 -0
- package/libs/xt-steps/index.wxml +34 -0
- package/libs/xt-steps/index.wxss +186 -0
- package/libs/xt-tabs/README.md +98 -0
- package/libs/xt-tabs/index.js +35 -0
- package/libs/xt-tabs/index.json +6 -0
- package/libs/xt-tabs/index.wxml +10 -0
- package/libs/xt-tabs/index.wxss +76 -0
- package/libs/xt-tag/README.md +65 -0
- package/libs/xt-tag/index.js +38 -0
- package/libs/xt-tag/index.json +7 -0
- package/libs/xt-tag/index.wxml +5 -0
- package/libs/xt-tag/index.wxss +36 -0
- package/libs/xt-toast/README.md +65 -0
- package/libs/xt-toast/index.js +85 -0
- package/libs/xt-toast/index.json +7 -0
- package/libs/xt-toast/index.wxml +6 -0
- package/libs/xt-toast/index.wxss +27 -0
- package/libs/xt-uploader/README.md +46 -0
- package/libs/xt-uploader/index.js +233 -0
- package/libs/xt-uploader/index.json +7 -0
- package/libs/xt-uploader/index.wxml +15 -0
- package/libs/xt-uploader/index.wxss +68 -0
- package/libs/xt-uploader/utils.js +69 -0
- package/package.json +1 -1
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# Search搜索框
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
常用于列表过渡,通过输入搜索筛选数据
|
|
5
|
+
|
|
6
|
+
### 效果图
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
### 引入
|
|
10
|
+
在app.json或页面配置json中引入
|
|
11
|
+
```
|
|
12
|
+
"usingComponents": {
|
|
13
|
+
"xt-search": "@xtdev/xt-miniprogram-ui/xt-search",
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 代码演示
|
|
18
|
+
|
|
19
|
+
### 默认模式,横向展示
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
<xt-steps></xt-steps>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 方形
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
<xt-steps isCircle="{{false}}"></xt-steps>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
## API
|
|
35
|
+
|
|
36
|
+
#### xt-steps props
|
|
37
|
+
|
|
38
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
39
|
+
| ----------- | ----------- | ---------- | ---------- |
|
|
40
|
+
| isCircle | 是否为圆角 | `Boolean` | true |
|
|
41
|
+
| placeholder | 当前输入框placeholder | `String` | 请输入内容 |
|
|
42
|
+
| isFocus | 是否自动聚焦 | `Boolean` | true |
|
|
43
|
+
| value | 默认值 | `String` | '' |
|
|
44
|
+
| remote | 是否为远程搜索(点击输入框将只执行onFocus指令。适用于跳转新页面搜索场景) | `Boolean` | false |
|
|
45
|
+
| rightBtnText | 提交按钮文案 | `String` | '搜索' |
|
|
46
|
+
|
|
47
|
+
#### 事件
|
|
48
|
+
|
|
49
|
+
| 事件名称 | 说明 | 参数 |
|
|
50
|
+
| ----------- | ----------- | ----------- |
|
|
51
|
+
| onFocus | 聚焦 | - |
|
|
52
|
+
| onBlur | 失去焦点 | - |
|
|
53
|
+
| onInput | 输入 | 输入框值 |
|
|
54
|
+
| onClear | 清除 | - |
|
|
55
|
+
| onSearch | 按钮提交 | 输入框值 |
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
/**
|
|
3
|
+
* 组件的属性列表
|
|
4
|
+
*/
|
|
5
|
+
properties: {
|
|
6
|
+
// 搜索框样式,是否是圆的,默认为方
|
|
7
|
+
isCircle: {
|
|
8
|
+
type: Boolean,
|
|
9
|
+
value: true
|
|
10
|
+
},
|
|
11
|
+
placeholder: {
|
|
12
|
+
type: String,
|
|
13
|
+
value: "请输入内容"
|
|
14
|
+
},
|
|
15
|
+
// 是否自动聚焦
|
|
16
|
+
isFocus: {
|
|
17
|
+
type: Boolean,
|
|
18
|
+
value: false
|
|
19
|
+
},
|
|
20
|
+
value: {
|
|
21
|
+
type: String,
|
|
22
|
+
value: ''
|
|
23
|
+
},
|
|
24
|
+
// 是否远程搜索,如果为true。点击输入框将只执行onFocus指令。适用于跳转新页面搜索场景
|
|
25
|
+
remote: {
|
|
26
|
+
type: Boolean,
|
|
27
|
+
value: false
|
|
28
|
+
},
|
|
29
|
+
rightBtnText: {
|
|
30
|
+
type: String,
|
|
31
|
+
value: '搜索'
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* 组件的初始数据
|
|
37
|
+
*/
|
|
38
|
+
data: {
|
|
39
|
+
isActive: false,
|
|
40
|
+
// 输入框的输入值
|
|
41
|
+
inputVal: ''
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* 组件的方法列表
|
|
46
|
+
*/
|
|
47
|
+
methods: {
|
|
48
|
+
onFocus() {
|
|
49
|
+
if (!this.data.remote) {
|
|
50
|
+
this.setData({
|
|
51
|
+
isActive: true
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
this.triggerEvent('onFocus');
|
|
55
|
+
},
|
|
56
|
+
onBlur() {
|
|
57
|
+
this.setData({
|
|
58
|
+
isActive: false
|
|
59
|
+
});
|
|
60
|
+
this.triggerEvent('onBlur');
|
|
61
|
+
},
|
|
62
|
+
onInput(e) {
|
|
63
|
+
this.setData({
|
|
64
|
+
inputVal: e.detail.value
|
|
65
|
+
});
|
|
66
|
+
this.triggerEvent('onInput', e.detail.value);
|
|
67
|
+
},
|
|
68
|
+
clearInpVal() {
|
|
69
|
+
this.setData({
|
|
70
|
+
inputVal: ''
|
|
71
|
+
});
|
|
72
|
+
if (!this.data.isActive) {
|
|
73
|
+
this.triggerEvent('onClear');
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
onSearch() {
|
|
77
|
+
this.triggerEvent('onSearch', this.data.inputVal);
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
observers: {
|
|
81
|
+
value(val) {
|
|
82
|
+
this.setData({
|
|
83
|
+
inputVal: val
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
<!--components/xt-search.wxml-->
|
|
2
|
+
<view class="xt-search-container">
|
|
3
|
+
<view class=".xt-search-box {{isActive? 'xt-search-active':''}} {{isCircle? 'search-box-circle' : ''}}">
|
|
4
|
+
<xt-icon class="xt-search-icon" slot="left-icon" icon="sousuo" size="32"></xt-icon>
|
|
5
|
+
<view wx:if="{{remote}}" class="xt-search-input {{inputVal ?'' : 'placeholder'}}" bind:tap="onFocus">
|
|
6
|
+
{{inputVal||placeholder}}
|
|
7
|
+
</view>
|
|
8
|
+
<input wx:else class="xt-search-input" placeholder-class="xt-palceholder" confirm-type="search" bind:focus="onFocus" bindblur="onBlur" bindinput="onInput" value="{{ inputVal }}" bind:confirm="onSearch" focus="{{isFocus}}" placeholder="{{placeholder}}" />
|
|
9
|
+
<view slot="action" class="xt-search-btn {{isCircle? 'xt-search-btn-circle' : ''}}" placeholder="{{placeholder}}">
|
|
10
|
+
<view wx:if="{{inputVal}}" class="xt-clearimg-box" catchtap="clearInpVal">
|
|
11
|
+
<xt-icon class="xt-clear-img" icon="shibai-xiao" size="32"></xt-icon>
|
|
12
|
+
</view>
|
|
13
|
+
<text bind:tap="onSearch" class="xt-search-text">{{rightBtnText}}</text>
|
|
14
|
+
</view>
|
|
15
|
+
</view>
|
|
16
|
+
<view slot="show-more"></view>
|
|
17
|
+
</view>
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/* components/xt-search.wxss */
|
|
2
|
+
.xt-search-container {
|
|
3
|
+
position: relative;
|
|
4
|
+
display: flex;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.xt-search-box {
|
|
8
|
+
border: 2rpx solid #dddddd;
|
|
9
|
+
background-color: white;
|
|
10
|
+
box-sizing: border-box;
|
|
11
|
+
overflow: hidden;
|
|
12
|
+
display: flex;
|
|
13
|
+
align-items: center;
|
|
14
|
+
justify-content: space-between;
|
|
15
|
+
height: 80rpx;
|
|
16
|
+
border-radius: 10rpx;
|
|
17
|
+
overflow: hidden;
|
|
18
|
+
flex: 1;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.xt-search-box.search-box-circle {
|
|
22
|
+
border-radius: 40rpx;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.xt-search-icon {
|
|
26
|
+
color: #999999;
|
|
27
|
+
padding-left: 24rpx;
|
|
28
|
+
padding-right: 8rpx;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.xt-search-input {
|
|
32
|
+
width: 100%;
|
|
33
|
+
flex: 1;
|
|
34
|
+
font-size: 34rpx;
|
|
35
|
+
font-weight: 400;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.xt-palceholder {
|
|
39
|
+
font-size: 34rpx;
|
|
40
|
+
color: #999999;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.xt-clearimg-box {
|
|
44
|
+
width: 64rpx;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.xt-clear-img {
|
|
48
|
+
z-index: 999;
|
|
49
|
+
color: #B8B8B8;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.xt-search-btn {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
height: 40rpx;
|
|
56
|
+
line-height: 40rpx;
|
|
57
|
+
box-sizing: border-box;
|
|
58
|
+
text-align: center;
|
|
59
|
+
font-weight: 800;
|
|
60
|
+
color: #6722ab;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.xt-search-btn .xt-search-text {
|
|
64
|
+
font-size: 34rpx;
|
|
65
|
+
width: 120rpx;
|
|
66
|
+
display: inline-block;
|
|
67
|
+
border-left: 2rpx solid #e5e5e5;
|
|
68
|
+
line-height: 32rpx !important;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.xt-search-btn-circle .xt-search-text {
|
|
72
|
+
width: 132rpx;
|
|
73
|
+
font-size: 34rpx;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.xt-search-active {
|
|
77
|
+
border-color: #6722ab;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.xt-placeholder {
|
|
81
|
+
color: #999999;
|
|
82
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!--
|
|
2
|
+
* @Author: Mr.Hu
|
|
3
|
+
* @Date: 2023-07-17 17:45:42
|
|
4
|
+
* @Description:
|
|
5
|
+
* @LastEditors: Mr.Hu
|
|
6
|
+
-->
|
|
7
|
+
# 列表卡片
|
|
8
|
+
|
|
9
|
+
### 介绍
|
|
10
|
+
列表中的单个展示项
|
|
11
|
+
|
|
12
|
+
### 效果图
|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
### 引入
|
|
16
|
+
在app.json或页面配置json中引入
|
|
17
|
+
```
|
|
18
|
+
"usingComponents": {
|
|
19
|
+
"xt-stepper": "@xtdev/xt-miniprogram-ui/xt-stepper",
|
|
20
|
+
}
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## 代码演示
|
|
24
|
+
|
|
25
|
+
### 基础用法
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
<xt-stepper value="{{good.qty}}" step="{{good.step}}" min="{{good.min}}" max="{{good.max}}" bind:change="inputChange" stepTips="3的倍数瓶起购"/>
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## API
|
|
32
|
+
|
|
33
|
+
#### xt-stepper props
|
|
34
|
+
|
|
35
|
+
| 参数 | 说明 | 类型 |
|
|
36
|
+
| ----------- | ----------- | ---------- |
|
|
37
|
+
| value | 输入框当前值 | `Number` |
|
|
38
|
+
| min | 最小值 | `Number` |
|
|
39
|
+
| max | 最大值 | `Number` |
|
|
40
|
+
| step | 每次点击改变的间隔大小 | `Number` |
|
|
41
|
+
| background | 背景色 | `String` |
|
|
42
|
+
| color | 字体颜色(前景色) | `String` |
|
|
43
|
+
| disabled | 是否为禁用步进器,默认否 | `Boolean` |
|
|
44
|
+
| disableInput | 是否为禁用输入框,默认否 | `Boolean` |
|
|
45
|
+
|
|
46
|
+
## Event
|
|
47
|
+
|
|
48
|
+
| 事件名 | 说明 | 回调参数 |
|
|
49
|
+
| ----------- | ----------- | ----------- |
|
|
50
|
+
| change | 输入框值改变时触发 | `Number` |
|
|
51
|
+
| focus | 输入框聚焦时触发 | `event` |
|
|
52
|
+
| blur | 输入框失焦时触发 | `event` |
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
// components/v-stepper/index.js
|
|
2
|
+
/**
|
|
3
|
+
* NumberBox 数字输入框
|
|
4
|
+
* @description 带加减按钮的数字输入框
|
|
5
|
+
* @tutorial https://ext.dcloud.net.cn/plugin?id=31
|
|
6
|
+
* @property {Number} value 输入框当前值
|
|
7
|
+
* @property {Number} min 最小值
|
|
8
|
+
* @property {Number} max 最大值
|
|
9
|
+
* @property {Number} step 每次点击改变的间隔大小
|
|
10
|
+
* @property {String} background 背景色
|
|
11
|
+
* @property {String} color 字体颜色(前景色)
|
|
12
|
+
* @property {Boolean} disabled = [true|false] 是否为禁用状态
|
|
13
|
+
* @property {String} stepTips 进步倍数纠正提示文案
|
|
14
|
+
* @event {Function} change 输入框值改变时触发的事件,参数为输入框当前的 value
|
|
15
|
+
* @event {Function} focus 输入框聚焦时触发的事件,参数为 event 对象
|
|
16
|
+
* @event {Function} blur 输入框失焦时触发的事件,参数为 event 对象
|
|
17
|
+
*/
|
|
18
|
+
Component({
|
|
19
|
+
lifetimes: {
|
|
20
|
+
attached: function() {
|
|
21
|
+
// 在组件实例进入页面节点树时执行
|
|
22
|
+
},
|
|
23
|
+
detached: function() {
|
|
24
|
+
// 在组件实例被从页面节点树移除时执行
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
/**
|
|
28
|
+
* 组件的属性列表
|
|
29
|
+
*/
|
|
30
|
+
properties: {
|
|
31
|
+
value: {
|
|
32
|
+
type: [Number, String],
|
|
33
|
+
default: 1
|
|
34
|
+
},
|
|
35
|
+
min: {
|
|
36
|
+
type: Number,
|
|
37
|
+
default: 0
|
|
38
|
+
},
|
|
39
|
+
max: {
|
|
40
|
+
type: Number,
|
|
41
|
+
default: 100
|
|
42
|
+
},
|
|
43
|
+
step: {
|
|
44
|
+
type: Number,
|
|
45
|
+
default: 1
|
|
46
|
+
},
|
|
47
|
+
background: {
|
|
48
|
+
type: String,
|
|
49
|
+
default: '#fff'
|
|
50
|
+
},
|
|
51
|
+
color: {
|
|
52
|
+
type: String,
|
|
53
|
+
default: '#000'
|
|
54
|
+
},
|
|
55
|
+
disabled: {
|
|
56
|
+
type: Boolean,
|
|
57
|
+
default: false
|
|
58
|
+
},
|
|
59
|
+
stepTips: {
|
|
60
|
+
type: String,
|
|
61
|
+
default: ''
|
|
62
|
+
},
|
|
63
|
+
disableInput: {
|
|
64
|
+
type: Boolean,
|
|
65
|
+
default: false
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* 组件的初始数据
|
|
71
|
+
*/
|
|
72
|
+
data: {
|
|
73
|
+
inputValue: 0
|
|
74
|
+
},
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 组件的方法列表
|
|
78
|
+
*/
|
|
79
|
+
methods: {
|
|
80
|
+
// 输入完成数据预处理
|
|
81
|
+
// input 和 按钮都触发
|
|
82
|
+
preHandler(count) {
|
|
83
|
+
// -. 小数转整数
|
|
84
|
+
count = Math.ceil(count);
|
|
85
|
+
// -. 取3的倍数
|
|
86
|
+
if (count % this.data.step != 0) {
|
|
87
|
+
wx.showToast({
|
|
88
|
+
title: this.data.stepTips,
|
|
89
|
+
icon: 'none',
|
|
90
|
+
duration: 1500
|
|
91
|
+
})
|
|
92
|
+
count = Math.ceil(count / this.data.step) * this.data.step;
|
|
93
|
+
}
|
|
94
|
+
// -. 判断是否大于最大值
|
|
95
|
+
if (count > this.data.max) {
|
|
96
|
+
count = this.data.max;
|
|
97
|
+
}
|
|
98
|
+
// -. 判断是否小于最小值
|
|
99
|
+
if (count < this.data.min) {
|
|
100
|
+
count = this.data.min;
|
|
101
|
+
}
|
|
102
|
+
this.setData({
|
|
103
|
+
inputValue: count
|
|
104
|
+
});
|
|
105
|
+
return count;
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* 加减按钮
|
|
109
|
+
* @param {*} type
|
|
110
|
+
*/
|
|
111
|
+
_calcValue(e) {
|
|
112
|
+
const type = e.currentTarget.dataset.type;
|
|
113
|
+
let value = this.data.inputValue;
|
|
114
|
+
// 判断是否禁用
|
|
115
|
+
if (this.data.disabled) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
// 加减库存
|
|
119
|
+
if (type === 'minus') {
|
|
120
|
+
if (value <= this.data.min) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
value -= this.data.step;
|
|
124
|
+
} else if (type === 'plus') {
|
|
125
|
+
if (value >= this.data.max) {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
value += this.data.step;
|
|
129
|
+
}
|
|
130
|
+
value = this.preHandler(value);
|
|
131
|
+
this.triggerEvent('change', value);
|
|
132
|
+
},
|
|
133
|
+
/**
|
|
134
|
+
* 输入框失去焦点
|
|
135
|
+
* @param {*} event
|
|
136
|
+
*/
|
|
137
|
+
_onBlur(event) {
|
|
138
|
+
let count = event.detail.value;
|
|
139
|
+
count = this.preHandler(count);
|
|
140
|
+
this.triggerEvent('change', +count);
|
|
141
|
+
},
|
|
142
|
+
_onFocus(event) {
|
|
143
|
+
this.triggerEvent('focus', event);
|
|
144
|
+
},
|
|
145
|
+
onInput(e) {
|
|
146
|
+
this.setData({
|
|
147
|
+
inputValue: e.detail.value
|
|
148
|
+
});
|
|
149
|
+
this.triggerEvent('change', +inputValue);
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
observers: {
|
|
153
|
+
value(val) {
|
|
154
|
+
const inputValue = this.data.inputValue + val;
|
|
155
|
+
this.setData({inputValue});
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<view class="uni-numbox">
|
|
2
|
+
<view catchtap="_calcValue" data-type="minus" class="uni-numbox__minus uni-numbox-btns" style="background:{{background}}">
|
|
3
|
+
<image wx:if="{{inputValue <= min || disabled}}" src="https://img.tanjiu.cn/home/N3hXeF3t62GfK2xAsn6PyCATw82d5QeK.png" />
|
|
4
|
+
<image wx:else src="https://img.tanjiu.cn/home/dznTAnDMTRR4NTmZnHYXpHxEdTPZcT5t.png" />
|
|
5
|
+
</view>
|
|
6
|
+
<input disabled="{{disableInput || disabled}}" bind:focus="_onFocus" bind:blur="_onBlur" class="uni-numbox__value" type="number" value="{{inputValue}}" style="background:{{background}}, color:{{color}}" />
|
|
7
|
+
<view catchtap="_calcValue" data-type="plus" class="uni-numbox__plus uni-numbox-btns" style="background:{{background}}">
|
|
8
|
+
<image wx:if="{{inputValue >= max || disabled}}" src="https://img.tanjiu.cn/home/Bp4De4y8FFwYk3s8bbMhb6YbwKmp4yxf.png" />
|
|
9
|
+
<image wx:else src="https://img.tanjiu.cn/home/WeSZCF7QHwptXEM7fWh5EPKt72meekPn.png" />
|
|
10
|
+
</view>
|
|
11
|
+
</view>
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
.uni-numbox {
|
|
2
|
+
/* #ifndef APP-NVUE */
|
|
3
|
+
display: flex;
|
|
4
|
+
/* #endif */
|
|
5
|
+
flex-direction: row;
|
|
6
|
+
}
|
|
7
|
+
.uni-numbox image {
|
|
8
|
+
width: 64rpx;
|
|
9
|
+
height: 64rpx;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
.add-btn {
|
|
13
|
+
width: 64rpx;
|
|
14
|
+
height: 64rpx;
|
|
15
|
+
background: #6722ab;
|
|
16
|
+
font-size: 44rpx;
|
|
17
|
+
color: white;
|
|
18
|
+
border-radius: 64rpx;
|
|
19
|
+
text-align: center;
|
|
20
|
+
border-radius: #dddddd;
|
|
21
|
+
}
|
|
22
|
+
.reduce-btn {
|
|
23
|
+
width: 64rpx;
|
|
24
|
+
height: 64rpx;
|
|
25
|
+
background: white;
|
|
26
|
+
font-size: 44rpx;
|
|
27
|
+
color: #6722ab;
|
|
28
|
+
border-radius: 64rpx;
|
|
29
|
+
text-align: center;
|
|
30
|
+
border: 2rpx solid #dddddd;
|
|
31
|
+
}
|
|
32
|
+
.uni-numbox-btns {
|
|
33
|
+
/* #ifndef APP-NVUE */
|
|
34
|
+
display: flex;
|
|
35
|
+
/* #endif */
|
|
36
|
+
flex-direction: row;
|
|
37
|
+
align-items: center;
|
|
38
|
+
justify-content: center;
|
|
39
|
+
padding: 0 ;
|
|
40
|
+
background-color: #f5f5f5;
|
|
41
|
+
/* #ifdef H5 */
|
|
42
|
+
cursor: pointer;
|
|
43
|
+
|
|
44
|
+
/* #endif */
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.uni-numbox__value {
|
|
48
|
+
margin: 0 16rpx;
|
|
49
|
+
width: 120rpx;
|
|
50
|
+
height: 64rpx;
|
|
51
|
+
font-size: 34rpx;
|
|
52
|
+
color: #222222;
|
|
53
|
+
font-family: FengTan-Regular, FengTan;
|
|
54
|
+
border-radius: 32rpx;
|
|
55
|
+
font-weight: 800;
|
|
56
|
+
background-color: #fff;
|
|
57
|
+
text-align: center;
|
|
58
|
+
border: 2rpx solid #dddddd;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.uni-numbox__minus, .uni-numbox__plus {
|
|
62
|
+
border-radius: 64rpx;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.uni-numbox--text {
|
|
66
|
+
line-height: 20rpx;
|
|
67
|
+
font-size: 20rpx;
|
|
68
|
+
font-weight: 300;
|
|
69
|
+
color: #333;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.uni-numbox .uni-numbox--disabled {
|
|
73
|
+
color: #c0c0c0 !important;
|
|
74
|
+
/* #ifdef H5 */
|
|
75
|
+
cursor: not-allowed;
|
|
76
|
+
/* #endif */
|
|
77
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Steps步骤条
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
用于展示操作流程的各个环节,让用户了解当前的操作在整体流程中的位置
|
|
5
|
+
|
|
6
|
+
###效果图
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
### 引入
|
|
10
|
+
在app.json或页面配置json中引入
|
|
11
|
+
```
|
|
12
|
+
"usingComponents": {
|
|
13
|
+
"xt-steps": "@xtdev/xt-miniprogram-ui/xt-steps",
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 代码演示
|
|
18
|
+
|
|
19
|
+
### 默认模式,横向展示
|
|
20
|
+

|
|
21
|
+
|
|
22
|
+
```
|
|
23
|
+
<xt-steps steps="{{steps}}" active="{{active}}"></xt-steps>
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 默认模式,纵向展示
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
```
|
|
30
|
+
<xt-steps direction="vertical" steps="{{steps}}" active="{{active}}"></xt-steps>
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### 简约模式,横向展示
|
|
34
|
+

|
|
35
|
+
```
|
|
36
|
+
<xt-steps type="brief" steps="{{steps}}" active="{{active}}"></xt-steps>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### 简约模式,纵向展示
|
|
40
|
+

|
|
41
|
+
```
|
|
42
|
+
<xt-steps type="brief" direction="vertical" steps="{{steps}}" active="{{active}}"></xt-steps>
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### 插槽模式,纵向展示
|
|
46
|
+
提示:插槽name规则为slot-{{index}} index从0开始
|
|
47
|
+

|
|
48
|
+
```
|
|
49
|
+
<xt-steps type="brief" direction="vertical" steps="{{steps}}" active="{{active}}">
|
|
50
|
+
<view slot="slot-1" class="custom-box">
|
|
51
|
+
<view slot:listIndex>订单编号:123456{{ listIndex }}</view>
|
|
52
|
+
<xt-button style="margin-left: 20rpx" size="small">复制</xt-button>
|
|
53
|
+
</view>
|
|
54
|
+
<view slot="slot-2" class="custom-box">
|
|
55
|
+
<view slot:listIndex>订单编号:123456777{{ listIndex }}</view>
|
|
56
|
+
<xt-button style="margin-left: 20rpx" size="small">复制</xt-button>
|
|
57
|
+
</view>
|
|
58
|
+
</xt-steps>
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
##API
|
|
63
|
+
|
|
64
|
+
#### xt-steps props
|
|
65
|
+
|
|
66
|
+
| 参数 | 说明 | 类型 | 默认值 |
|
|
67
|
+
| --------- | ------------------------------------ | ------------- | ---------- |
|
|
68
|
+
| steps | 步骤配置集合 | `stepsItem[]` | [] |
|
|
69
|
+
| active | 当前步骤 | `Number` | 0 |
|
|
70
|
+
| type | 当前步骤,可选值static、brief | `String` | static |
|
|
71
|
+
| direction | 展示方向,可选值horizontal、vertical | `String` | horizontal |
|
|
72
|
+
|
|
73
|
+
#### stepsItem Props
|
|
74
|
+
|
|
75
|
+
| 参数 | 说明 | 类型 |
|
|
76
|
+
| ----- | -------- | --------- |
|
|
77
|
+
| title | 标题 | `String` |
|
|
78
|
+
| desc | 副标题 | `String` |
|
|
79
|
+
| slot | 是否插槽 | `Boolean` |
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
Component({
|
|
2
|
+
options: {
|
|
3
|
+
multipleSlots: true
|
|
4
|
+
},
|
|
5
|
+
properties: {
|
|
6
|
+
steps: {
|
|
7
|
+
type: Array,
|
|
8
|
+
value: []
|
|
9
|
+
},
|
|
10
|
+
active: {
|
|
11
|
+
type: Number,
|
|
12
|
+
value: 0
|
|
13
|
+
},
|
|
14
|
+
type: {
|
|
15
|
+
type: String,
|
|
16
|
+
value: 'static'
|
|
17
|
+
},
|
|
18
|
+
direction: {
|
|
19
|
+
type: String,
|
|
20
|
+
value: 'horizontal'
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 组件的初始数据
|
|
26
|
+
*/
|
|
27
|
+
data: {
|
|
28
|
+
},
|
|
29
|
+
attached: function () {
|
|
30
|
+
},
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* 组件的方法列表
|
|
34
|
+
*/
|
|
35
|
+
methods: {
|
|
36
|
+
}
|
|
37
|
+
});
|