Commit 9335e21d authored by 刘文虎's avatar 刘文虎

修改布进器

parent e7098dec
Pipeline #3968 canceled with stages
This diff is collapsed.
...@@ -2,8 +2,7 @@ ...@@ -2,8 +2,7 @@
<view class="u-numberbox"> <view class="u-numberbox">
<view <view
class="u-icon-minus" class="u-icon-minus"
@touchstart.stop.prevent="btnTouchStart('minus')" @tap.stop.prevent="btnTouchStart('minus')"
@touchend.stop.prevent="clearTimer"
:class="{ 'u-icon-disabled': disabled || inputVal <= min }" :class="{ 'u-icon-disabled': disabled || inputVal <= min }"
:style="{ :style="{
background: '#ffffff', background: '#ffffff',
...@@ -20,8 +19,7 @@ ...@@ -20,8 +19,7 @@
@blur="onBlur" @focus="onFocus" type="digit" :style="{ color: '#333333', fontSize: size + 'rpx', height: inputHeight + 'rpx', width: inputWidth + 'rpx'}" v-if="showMinus" /> @blur="onBlur" @focus="onFocus" type="digit" :style="{ color: '#333333', fontSize: size + 'rpx', height: inputHeight + 'rpx', width: inputWidth + 'rpx'}" v-if="showMinus" />
<view <view
class="u-icon-plus" class="u-icon-plus"
@touchstart.stop.prevent="btnTouchStart('plus')" @tap.stop.prevent="btnTouchStart('plus')"
@touchend.stop.prevent="clearTimer"
:class="{ 'u-icon-disabled': disabled || inputVal >= max }" :class="{ 'u-icon-disabled': disabled || inputVal >= max }"
:style="{ :style="{
background: themeColors, background: themeColors,
...@@ -227,13 +225,13 @@ export default { ...@@ -227,13 +225,13 @@ export default {
// 先执行一遍方法,否则会造成松开手时,就执行了clearTimer,导致无法实现功能 // 先执行一遍方法,否则会造成松开手时,就执行了clearTimer,导致无法实现功能
this[callback](); this[callback]();
// 如果没开启长按功能,直接返回 // 如果没开启长按功能,直接返回
if (!this.longPress) return; // if (!this.longPress) return;
clearInterval(this.timer); //再次清空定时器,防止重复注册定时器 // clearInterval(this.timer); //再次清空定时器,防止重复注册定时器
this.timer = null; // this.timer = null;
this.timer = setInterval(() => { // this.timer = setInterval(() => {
// 执行加或减函数 // // 执行加或减函数
this[callback](); // this[callback]();
}, this.pressTime); // }, this.pressTime);
}, },
clearTimer() { clearTimer() {
this.$nextTick(() => { this.$nextTick(() => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment