diff --git a/example/pages/stepper/index.wxml b/example/pages/stepper/index.wxml
index 79b994e9..4d3aa4c8 100644
--- a/example/pages/stepper/index.wxml
+++ b/example/pages/stepper/index.wxml
@@ -14,6 +14,7 @@
+ small:
-
+
+ >
+
+ middle:
+
+
+ large:
+
diff --git a/packages/stepper/README.md b/packages/stepper/README.md
index 863be6fb..0cb7bcee 100644
--- a/packages/stepper/README.md
+++ b/packages/stepper/README.md
@@ -24,7 +24,7 @@ Page({
min: 1,
// 最大可到的数字
max: 1,
- // 小尺寸, 默认大尺寸
+ // 尺寸
size: 'small'
}
},
@@ -58,7 +58,7 @@ Page({
| 参数 | 说明 | 类型 | 默认值 | 必须 |
|-----------|-----------|-----------|-------------|-------------|
-| size | 计数器尺寸 | String | - | |
+| size | 计数器尺寸:small、middle、large | String | middle | |
| stepper | 计数器的值 | Number | `1` | 必须 |
| min | 计数器最小值 | Number | `1` | |
| max | 计数器最大值 | Number | 无穷大 | |
diff --git a/packages/stepper/index.js b/packages/stepper/index.js
index 50488aed..ba1c55b2 100644
--- a/packages/stepper/index.js
+++ b/packages/stepper/index.js
@@ -4,7 +4,10 @@ const VERY_LARGE_NUMBER = 2147483647;
Component({
properties: {
- size: String,
+ size: {
+ type: String,
+ value: 'middle'
+ },
stepper: {
type: Number,
value: 1
@@ -37,7 +40,7 @@ Component({
} else if (type === 'plus') {
stepper += step;
}
-
+
if (stepper < this.data.min || stepper > this.data.max) return null;
this.triggerEvent('change', stepper);
diff --git a/packages/stepper/index.pcss b/packages/stepper/index.pcss
index 50383eef..c019c8c0 100644
--- a/packages/stepper/index.pcss
+++ b/packages/stepper/index.pcss
@@ -3,10 +3,8 @@
}
.zan-stepper view {
display: inline-block;
- line-height: 20px;
padding: 5px 0;
text-align: center;
- min-width: 40px;
box-sizing: border-box;
vertical-align: middle;
font-size: 12px;
@@ -21,12 +19,9 @@
display: inline-block;
text-align: center;
vertical-align: middle;
- height: 30px;
- width: 40px;
/* 重置 input 默认样式 */
min-height: auto;
font-size: 12px;
- line-height: 30px;
}
.zan-stepper .zan-stepper__plus {
border-left: none;
@@ -46,3 +41,23 @@
line-height: 28px;
height: 28px;
}
+
+.zan-stepper--middle view {
+ min-width: 40px;
+ line-height: 20px;
+}
+.zan-stepper--middle .zan-stepper__text {
+ width: 40px;
+ line-height: 30px;
+ height: 30px;
+}
+
+.zan-stepper--large view {
+ min-width: 44px;
+ line-height: 22px;
+}
+.zan-stepper--large .zan-stepper__text {
+ width: 44px;
+ line-height: 32px;
+ height: 32px;
+}
diff --git a/packages/stepper/index.wxml b/packages/stepper/index.wxml
index c3d2c6c0..8e3b9fe8 100644
--- a/packages/stepper/index.wxml
+++ b/packages/stepper/index.wxml
@@ -1,4 +1,4 @@
-
+