diff --git a/example/pages/stepper/index.wxml b/example/pages/stepper/index.wxml
index cc0e59a9..417bd361 100644
--- a/example/pages/stepper/index.wxml
+++ b/example/pages/stepper/index.wxml
@@ -18,6 +18,10 @@
+
+
+
+
diff --git a/example/project.config.json b/example/project.config.json
index f8cebc50..303f0f39 100644
--- a/example/project.config.json
+++ b/example/project.config.json
@@ -339,4 +339,4 @@
]
}
}
-}
+}
\ No newline at end of file
diff --git a/packages/stepper/README.md b/packages/stepper/README.md
index 0123dc4f..fc063d0e 100644
--- a/packages/stepper/README.md
+++ b/packages/stepper/README.md
@@ -64,6 +64,14 @@ Page({
```
+### 关闭长按
+
+通过设置`long-press`属性决定步进器是否开启长按手势
+
+```html
+
+```
+
### 固定小数位数
通过设置`decimal-length`属性可以保留固定的小数位数
@@ -127,6 +135,7 @@ Page({
| decimal-length | 固定显示的小数位数 | *number* | - | - |
| disable-plus | 是否禁用增加按钮 | *boolean* | - | - |
| disable-minus | 是否禁用减少按钮 | *boolean* | - | - |
+| long-press | 是否开启长按手势 | *boolean* | `true` | - |
### Events
diff --git a/packages/stepper/index.ts b/packages/stepper/index.ts
index ebd67c59..c9ec2f4d 100644
--- a/packages/stepper/index.ts
+++ b/packages/stepper/index.ts
@@ -77,7 +77,11 @@ VantComponent({
value: true
},
disablePlus: Boolean,
- disableMinus: Boolean
+ disableMinus: Boolean,
+ longPress: {
+ type: Boolean,
+ value: true
+ },
},
data: {
@@ -160,6 +164,9 @@ VantComponent({
},
onTouchStart(event: Weapp.Event) {
+ if (!this.data.longPress) {
+ return;
+ }
clearTimeout(this.longPressTimer);
const { type } = event.currentTarget.dataset;
@@ -174,6 +181,9 @@ VantComponent({
},
onTouchEnd() {
+ if (!this.data.longPress) {
+ return;
+ }
clearTimeout(this.longPressTimer);
},