@xtdev/xt-miniprogram-ui 1.0.10 → 1.0.13
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/xt-button/README.md +60 -0
- package/libs/xt-button/index.js +116 -0
- package/libs/xt-button/index.json +6 -0
- package/libs/xt-button/index.wxml +31 -0
- package/libs/xt-button/index.wxss +70 -0
- package/libs/xt-card-cell/README.md +65 -0
- package/libs/xt-card-cell/index.wxss +1 -0
- package/libs/xt-dialog/README.md +152 -0
- package/libs/xt-dialog/index.js +126 -0
- package/libs/xt-dialog/index.json +4 -0
- package/libs/xt-dialog/index.wxml +51 -0
- package/libs/xt-dialog/index.wxss +121 -0
- package/libs/xt-icon/README.md +39 -0
- package/libs/xt-icon/index.wxss +25 -46
- package/libs/xt-search/README.md +55 -0
- package/libs/xt-search/index.js +0 -37
- package/libs/xt-search/index.wxml +7 -7
- package/libs/xt-search/index.wxss +3 -3
- package/libs/xt-stepper/README.md +52 -0
- package/libs/xt-stepper/index.js +158 -0
- package/libs/xt-stepper/index.json +4 -0
- package/libs/xt-stepper/index.wxml +11 -0
- package/libs/xt-stepper/index.wxss +83 -0
- package/libs/xt-steps/README.md +61 -0
- package/libs/xt-steps/index.js +37 -0
- package/libs/xt-steps/index.json +7 -0
- package/libs/xt-steps/index.wxml +32 -0
- package/libs/xt-steps/index.wxss +180 -0
- package/libs/xt-tag/README.md +65 -0
- package/libs/xt-tag/index.js +38 -0
- package/libs/xt-tag/index.json +6 -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 +6 -0
- package/libs/xt-toast/index.wxml +6 -0
- package/libs/xt-toast/index.wxss +27 -0
- package/libs/xt-uploader/README.md +44 -0
- package/libs/xt-uploader/index.js +150 -0
- package/libs/xt-uploader/index.json +7 -0
- package/libs/xt-uploader/index.wxml +15 -0
- package/libs/xt-uploader/index.wxss +67 -0
- package/libs/xt-uploader/utils.js +73 -0
- package/package.json +1 -1
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/* src/xt-dialog/index.wxss */
|
|
2
|
+
|
|
3
|
+
.dialog_mask{
|
|
4
|
+
position: fixed;
|
|
5
|
+
top: 0;
|
|
6
|
+
left: 0;
|
|
7
|
+
z-index: 9999;
|
|
8
|
+
width: 100vw;
|
|
9
|
+
height: 100vh;
|
|
10
|
+
background-color: rgba(0, 0, 0, 0.6);
|
|
11
|
+
display: flex;
|
|
12
|
+
justify-content: center;
|
|
13
|
+
align-items: center;
|
|
14
|
+
}
|
|
15
|
+
.dialog_box{
|
|
16
|
+
padding: 64rpx 48rpx;
|
|
17
|
+
box-sizing: border-box;
|
|
18
|
+
border-radius: 16rpx;
|
|
19
|
+
text-align: center;
|
|
20
|
+
width: 654rpx;
|
|
21
|
+
/* margin: 100rpx auto; */
|
|
22
|
+
background-color: rgba(255, 255, 255);
|
|
23
|
+
}
|
|
24
|
+
.title{
|
|
25
|
+
line-height: 56rpx;
|
|
26
|
+
font-size: 40rpx;
|
|
27
|
+
font-family: PingFang SC-Semibold, PingFang SC;
|
|
28
|
+
font-weight: 800;
|
|
29
|
+
color: #000000;
|
|
30
|
+
margin-bottom: 32rpx;
|
|
31
|
+
}
|
|
32
|
+
.content{
|
|
33
|
+
line-height: 56rpx;
|
|
34
|
+
font-size: 40rpx;
|
|
35
|
+
font-family: PingFang SC-Regular, PingFang SC;
|
|
36
|
+
font-weight: 400;
|
|
37
|
+
color: #000000;
|
|
38
|
+
margin-bottom: 64rpx;
|
|
39
|
+
}
|
|
40
|
+
.image{
|
|
41
|
+
width: 558rpx;
|
|
42
|
+
height: 306rpx;
|
|
43
|
+
border-radius: 2rpx;
|
|
44
|
+
margin-bottom: 32rpx;
|
|
45
|
+
border-radius: 2rpx;
|
|
46
|
+
}
|
|
47
|
+
.default_btn{
|
|
48
|
+
width: 558rpx;
|
|
49
|
+
height: 96rpx;
|
|
50
|
+
line-height: 96rpx;
|
|
51
|
+
background: #6722AB;
|
|
52
|
+
border-radius: 120rpx;
|
|
53
|
+
color:#fff;
|
|
54
|
+
font-size: 40rpx;
|
|
55
|
+
font-family: PingFang SC-Semibold, PingFang SC;
|
|
56
|
+
font-weight: 800;
|
|
57
|
+
}
|
|
58
|
+
.cancel_btn{
|
|
59
|
+
margin-top: 24rpx;
|
|
60
|
+
width: 558rpx;
|
|
61
|
+
height: 94rpx;
|
|
62
|
+
border-radius: 120rpx;
|
|
63
|
+
border: 2rpx solid #999999;
|
|
64
|
+
line-height: 94rpx;
|
|
65
|
+
color:#000;
|
|
66
|
+
font-size: 40rpx;
|
|
67
|
+
font-family: PingFang SC-Semibold, PingFang SC;
|
|
68
|
+
font-weight: 800;
|
|
69
|
+
}
|
|
70
|
+
.inp_wrapper{
|
|
71
|
+
border-radius: 16rpx;
|
|
72
|
+
width: 558rpx;
|
|
73
|
+
box-sizing: border-box;
|
|
74
|
+
margin-bottom: 64rpx;
|
|
75
|
+
padding: 32rpx 24rpx;
|
|
76
|
+
background-color: #f5f5f5;
|
|
77
|
+
}
|
|
78
|
+
.inp_content{
|
|
79
|
+
box-sizing: border-box;
|
|
80
|
+
text-align: left;
|
|
81
|
+
width: 510rpx;
|
|
82
|
+
background-color: #f6f6f6;
|
|
83
|
+
font-size: 40rpx;
|
|
84
|
+
color: #000000;
|
|
85
|
+
}
|
|
86
|
+
.radio_box{
|
|
87
|
+
margin-bottom: 64rpx;
|
|
88
|
+
}
|
|
89
|
+
.radio_item{
|
|
90
|
+
display: flex;
|
|
91
|
+
align-items: baseline;
|
|
92
|
+
/* justify-content: space-between; */
|
|
93
|
+
margin-bottom: 32rpx;
|
|
94
|
+
}
|
|
95
|
+
.radio_item:last-child{
|
|
96
|
+
margin-bottom: 0;
|
|
97
|
+
}
|
|
98
|
+
.radio_icon{
|
|
99
|
+
margin-right: 16rpx;
|
|
100
|
+
width: 40rpx;
|
|
101
|
+
height: 40rpx;
|
|
102
|
+
}
|
|
103
|
+
.radio_content{
|
|
104
|
+
width: 502rpx;
|
|
105
|
+
text-align: left;
|
|
106
|
+
}
|
|
107
|
+
.radio_text{
|
|
108
|
+
line-height: 56rpx;
|
|
109
|
+
font-size: 40rpx;
|
|
110
|
+
font-family: PingFang SC-Regular, PingFang SC;
|
|
111
|
+
font-weight: 400;
|
|
112
|
+
color: #000000;
|
|
113
|
+
}
|
|
114
|
+
.radio_remark{
|
|
115
|
+
line-height: 44rpx;
|
|
116
|
+
font-size: 32rpx;
|
|
117
|
+
font-family: PingFang SC-Regular, PingFang SC;
|
|
118
|
+
font-weight: 400;
|
|
119
|
+
color: #999999;
|
|
120
|
+
margin-top: 16rpx;
|
|
121
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Icon图标
|
|
2
|
+
|
|
3
|
+
### 介绍
|
|
4
|
+
基于字体的图标集,具体查看iconfont
|
|
5
|
+
|
|
6
|
+
###效果图
|
|
7
|
+

|
|
8
|
+
|
|
9
|
+
### 引入
|
|
10
|
+
在app.json或页面配置json中引入
|
|
11
|
+
```
|
|
12
|
+
"usingComponents": {
|
|
13
|
+
"xt-icon": "@xtdev/xt-miniprogram-ui/xt-icon",
|
|
14
|
+
}
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## 代码演示
|
|
18
|
+
|
|
19
|
+
### 基础用法
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
<xt-icon icon="wenhao"></xt-icon>
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
### 图标大小
|
|
26
|
+
设置 `size` 属性控制图标大小
|
|
27
|
+
```
|
|
28
|
+
<xt-icon icon="wenhao" size="{{32}}">
|
|
29
|
+
</xt-card-cell>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
##API
|
|
33
|
+
|
|
34
|
+
####xt-icon props
|
|
35
|
+
|
|
36
|
+
| 参数 | 说明 | 类型 |
|
|
37
|
+
| ----------- | ----------- | ---------- |
|
|
38
|
+
| icon | 图标名称,具体值见iconfont | `String` |
|
|
39
|
+
| size | 图标大小,单位rpx | `Number` |
|
package/libs/xt-icon/index.wxss
CHANGED
|
@@ -1,81 +1,76 @@
|
|
|
1
1
|
@font-face {
|
|
2
2
|
font-family: "iconfont"; /* Project id 4088939 */
|
|
3
|
-
src: url(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
format("woff"),
|
|
7
|
-
url("//at.alicdn.com/t/c/font_4088939_xa6wjfwsbpj.ttf?t=1685353003131")
|
|
8
|
-
format("truetype");
|
|
3
|
+
src: url('https://at.alicdn.com/t/c/font_4088939_jcdv8i40wy.woff2?t=1690182324093') format('woff2'),
|
|
4
|
+
url('https://at.alicdn.com/t/c/font_4088939_jcdv8i40wy.woff?t=1690182324093') format('woff'),
|
|
5
|
+
url('https://at.alicdn.com/t/c/font_4088939_jcdv8i40wy.ttf?t=1690182324093') format('truetype');
|
|
9
6
|
}
|
|
10
7
|
|
|
11
8
|
.iconfont {
|
|
12
9
|
font-family: "iconfont" !important;
|
|
10
|
+
font-size: 16px;
|
|
11
|
+
line-height: 1;
|
|
13
12
|
font-style: normal;
|
|
14
13
|
-webkit-font-smoothing: antialiased;
|
|
15
14
|
-moz-osx-font-smoothing: grayscale;
|
|
16
15
|
}
|
|
17
16
|
|
|
18
|
-
.icon-
|
|
17
|
+
.icon-dingwei:before {
|
|
19
18
|
content: "\e61e";
|
|
20
19
|
}
|
|
21
20
|
|
|
22
|
-
.icon-
|
|
21
|
+
.icon-weixing:before {
|
|
23
22
|
content: "\e61f";
|
|
24
23
|
}
|
|
25
24
|
|
|
26
|
-
.icon-
|
|
25
|
+
.icon-qianbao:before {
|
|
27
26
|
content: "\e620";
|
|
28
27
|
}
|
|
29
28
|
|
|
30
|
-
.icon-
|
|
29
|
+
.icon-liushui:before {
|
|
31
30
|
content: "\e621";
|
|
32
31
|
}
|
|
33
32
|
|
|
34
|
-
.icon-
|
|
33
|
+
.icon-tongguo:before {
|
|
35
34
|
content: "\e622";
|
|
36
35
|
}
|
|
37
36
|
|
|
38
|
-
.icon-
|
|
39
|
-
content: "\e623";
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.icon-a-11:before {
|
|
37
|
+
.icon-yinhangka:before {
|
|
43
38
|
content: "\e624";
|
|
44
39
|
}
|
|
45
40
|
|
|
46
|
-
.icon-
|
|
41
|
+
.icon-fangfu:before {
|
|
47
42
|
content: "\e625";
|
|
48
43
|
}
|
|
49
44
|
|
|
50
|
-
.icon-
|
|
45
|
+
.icon-saomiao:before {
|
|
51
46
|
content: "\e626";
|
|
52
47
|
}
|
|
53
48
|
|
|
54
|
-
.icon-
|
|
49
|
+
.icon-tixing:before {
|
|
55
50
|
content: "\e627";
|
|
56
51
|
}
|
|
57
52
|
|
|
58
|
-
.icon-
|
|
53
|
+
.icon-shibai-xiao:before {
|
|
59
54
|
content: "\e628";
|
|
60
55
|
}
|
|
61
56
|
|
|
62
|
-
.icon-
|
|
57
|
+
.icon-shouji:before {
|
|
63
58
|
content: "\e629";
|
|
64
59
|
}
|
|
65
60
|
|
|
66
|
-
.icon-
|
|
61
|
+
.icon-kabao:before {
|
|
67
62
|
content: "\e62a";
|
|
68
63
|
}
|
|
69
64
|
|
|
70
|
-
.icon-
|
|
65
|
+
.icon-paizhao:before {
|
|
71
66
|
content: "\e62b";
|
|
72
67
|
}
|
|
73
68
|
|
|
74
|
-
.icon-
|
|
69
|
+
.icon-shaixuan-yuan:before {
|
|
75
70
|
content: "\e62c";
|
|
76
71
|
}
|
|
77
72
|
|
|
78
|
-
.icon-
|
|
73
|
+
.icon-arrow:before {
|
|
79
74
|
content: "\e62d";
|
|
80
75
|
}
|
|
81
76
|
|
|
@@ -83,34 +78,26 @@
|
|
|
83
78
|
content: "\e60e";
|
|
84
79
|
}
|
|
85
80
|
|
|
86
|
-
.icon-
|
|
81
|
+
.icon-shibai-kongxin:before {
|
|
87
82
|
content: "\e60f";
|
|
88
83
|
}
|
|
89
84
|
|
|
90
|
-
.icon-
|
|
85
|
+
.icon-jingao-kongxin:before {
|
|
91
86
|
content: "\e614";
|
|
92
87
|
}
|
|
93
88
|
|
|
94
|
-
.icon-
|
|
89
|
+
.icon-dengdai-kongxin:before {
|
|
95
90
|
content: "\e615";
|
|
96
91
|
}
|
|
97
92
|
|
|
98
|
-
.icon-
|
|
93
|
+
.icon-dengdai:before {
|
|
99
94
|
content: "\e616";
|
|
100
95
|
}
|
|
101
96
|
|
|
102
|
-
.icon-
|
|
103
|
-
content: "\e61c";
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.icon-a-7:before {
|
|
97
|
+
.icon-shibai-da:before {
|
|
107
98
|
content: "\e61d";
|
|
108
99
|
}
|
|
109
100
|
|
|
110
|
-
.icon-jian-weixuanzhong:before {
|
|
111
|
-
content: "\e682";
|
|
112
|
-
}
|
|
113
|
-
|
|
114
101
|
.icon-jia-xuanzhong:before {
|
|
115
102
|
content: "\e683";
|
|
116
103
|
}
|
|
@@ -135,10 +122,6 @@
|
|
|
135
122
|
content: "\e688";
|
|
136
123
|
}
|
|
137
124
|
|
|
138
|
-
.icon-jinggao-hong:before {
|
|
139
|
-
content: "\e60b";
|
|
140
|
-
}
|
|
141
|
-
|
|
142
125
|
.icon-daohang:before {
|
|
143
126
|
content: "\e60d";
|
|
144
127
|
}
|
|
@@ -171,10 +154,6 @@
|
|
|
171
154
|
content: "\e619";
|
|
172
155
|
}
|
|
173
156
|
|
|
174
|
-
.icon-wenhao:before {
|
|
175
|
-
content: "\e61a";
|
|
176
|
-
}
|
|
177
|
-
|
|
178
157
|
.icon-zhankai:before {
|
|
179
158
|
content: "\e61b";
|
|
180
159
|
}
|
|
@@ -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 | 按钮提交 | 输入框值 |
|
package/libs/xt-search/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
// components/v-tab/index.js
|
|
2
1
|
Component({
|
|
3
2
|
/**
|
|
4
3
|
* 组件的属性列表
|
|
@@ -9,24 +8,6 @@ Component({
|
|
|
9
8
|
type: Boolean,
|
|
10
9
|
value: true
|
|
11
10
|
},
|
|
12
|
-
// 是否展示右侧更多按钮
|
|
13
|
-
showMore: {
|
|
14
|
-
type: Boolean,
|
|
15
|
-
value: false
|
|
16
|
-
},
|
|
17
|
-
list: {
|
|
18
|
-
type: Array,
|
|
19
|
-
value: [
|
|
20
|
-
{
|
|
21
|
-
name: '',
|
|
22
|
-
show: true
|
|
23
|
-
}
|
|
24
|
-
]
|
|
25
|
-
},
|
|
26
|
-
index: {
|
|
27
|
-
type: Number,
|
|
28
|
-
value: 0
|
|
29
|
-
},
|
|
30
11
|
placeholder: {
|
|
31
12
|
type: String,
|
|
32
13
|
value: "请输入内容"
|
|
@@ -48,10 +29,6 @@ Component({
|
|
|
48
29
|
rightBtnText: {
|
|
49
30
|
type: String,
|
|
50
31
|
value: '搜索'
|
|
51
|
-
},
|
|
52
|
-
extendType: {
|
|
53
|
-
type: Number,
|
|
54
|
-
value: 1
|
|
55
32
|
}
|
|
56
33
|
},
|
|
57
34
|
|
|
@@ -97,21 +74,7 @@ Component({
|
|
|
97
74
|
}
|
|
98
75
|
},
|
|
99
76
|
onSearch() {
|
|
100
|
-
console.log('输入值value', this.data.inputVal);
|
|
101
77
|
this.triggerEvent('onSearch', this.data.inputVal);
|
|
102
|
-
},
|
|
103
|
-
onSelect(e) {
|
|
104
|
-
const val = e.currentTarget.dataset.value;
|
|
105
|
-
if (val == 'receive') {
|
|
106
|
-
wx.navigateTo({
|
|
107
|
-
url: `/packageD/pages/searchPoint/index?type=${this.properties.extendType === 1 ? 'agent' : 'cigarette'}`
|
|
108
|
-
});
|
|
109
|
-
} else {
|
|
110
|
-
wx.navigateTo({
|
|
111
|
-
url: `/packageD/pages/deletePoint/index?status=remove&type=${this.properties.extendType === 1 ? 'agent' : 'cigarette'}`
|
|
112
|
-
});
|
|
113
|
-
}
|
|
114
|
-
this.selectComponent('#item').toggle();
|
|
115
78
|
}
|
|
116
79
|
},
|
|
117
80
|
observers: {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
<!--components/xt-search.wxml-->
|
|
2
|
-
<view class="container">
|
|
2
|
+
<view class="xt-seatch-container">
|
|
3
3
|
<view class="search-box {{isActive? 'search-active':''}} {{isCircle? 'search-box-circle' : ''}}">
|
|
4
|
-
<xt-icon class="search-icon" slot="left-icon" icon="sousuo" size="
|
|
5
|
-
<view class="search-input {{inputVal ?'' : 'placeholder'}}" bind:tap="onFocus"
|
|
4
|
+
<xt-icon class="search-icon" slot="left-icon" icon="sousuo" size="32"></xt-icon>
|
|
5
|
+
<view wx:if="{{remote}}" class="search-input {{inputVal ?'' : 'placeholder'}}" bind:tap="onFocus">
|
|
6
6
|
{{inputVal||placeholder}}
|
|
7
7
|
</view>
|
|
8
|
-
<input class="search-input" placeholder-class="palceholder" confirm-type="search" bind:focus="onFocus"
|
|
8
|
+
<input wx:else class="search-input" placeholder-class="palceholder" confirm-type="search" bind:focus="onFocus" bindblur="onBlur" bindinput="onInput" value="{{ inputVal }}" bind:confirm="onSearch" focus="{{isFocus}}" placeholder="{{placeholder}}" />
|
|
9
9
|
<view slot="action" class="search-btn {{isCircle? 'search-btn-circle' : ''}}" placeholder="{{placeholder}}">
|
|
10
|
-
<view wx:if="{{inputVal}}" class="clearimg-box" catchtap="clearInpVal"
|
|
11
|
-
<xt-icon class="clear-img" icon="
|
|
10
|
+
<view wx:if="{{inputVal}}" class="clearimg-box" catchtap="clearInpVal">
|
|
11
|
+
<xt-icon class="clear-img" icon="shibai-xiao" size="32"></xt-icon>
|
|
12
12
|
</view>
|
|
13
|
-
<text bind:tap="onSearch" class="search-text"
|
|
13
|
+
<text bind:tap="onSearch" class="search-text">{{rightBtnText}}</text>
|
|
14
14
|
</view>
|
|
15
15
|
</view>
|
|
16
16
|
<view slot="show-more"></view>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* components/xt-search.wxss */
|
|
2
|
-
.container {
|
|
2
|
+
.xt-seatch-container {
|
|
3
3
|
position: relative;
|
|
4
4
|
display: flex;
|
|
5
5
|
}
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
|
|
47
47
|
.clear-img {
|
|
48
48
|
z-index: 999;
|
|
49
|
-
color: #
|
|
49
|
+
color: #B8B8B8;
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
.search-btn {
|
|
@@ -61,7 +61,7 @@
|
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
.search-btn .search-text {
|
|
64
|
-
font-size:
|
|
64
|
+
font-size: 34rpx;
|
|
65
65
|
width: 120rpx;
|
|
66
66
|
display: inline-block;
|
|
67
67
|
border-left: 2rpx solid #e5e5e5;
|
|
@@ -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
|
+
});
|