|
|
@@ -88,7 +88,8 @@ Component({
|
|
|
// 组件内容显示
|
|
|
inputValue: '-' + '1',
|
|
|
shieldWidth: '',
|
|
|
- shieldRight: ''
|
|
|
+ shieldRight: '',
|
|
|
+ inputTimer: null
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
@@ -100,8 +101,12 @@ Component({
|
|
|
* @author 刘尧
|
|
|
*/
|
|
|
changeStep(e){
|
|
|
+ console.log('e', e);
|
|
|
+ if(Number(e.detail) < 0){
|
|
|
+ e.detail = Number(e.detail) * -1
|
|
|
+ }
|
|
|
this.setData({
|
|
|
- inputValue: '-' + e.detail,
|
|
|
+ inputValue: e.detail * -1,
|
|
|
value: e.detail
|
|
|
})
|
|
|
// 触发自定义事件
|
|
|
@@ -155,10 +160,19 @@ Component({
|
|
|
* @author : 刘尧
|
|
|
* @date : 2024/6/3 08:44
|
|
|
* */
|
|
|
- onBlur(e){
|
|
|
- this.setData({
|
|
|
- checkFocus:false
|
|
|
- })
|
|
|
+ onBlur(e){
|
|
|
+ // 清除之前的定时器
|
|
|
+ if (this.data.inputTimer) {
|
|
|
+ clearTimeout(this.data.inputTimer);
|
|
|
+ }
|
|
|
+ // 设置新的定时器,等待一段时间来判断输入是否停止
|
|
|
+ this.setData({
|
|
|
+ inputTimer: setTimeout(() => {
|
|
|
+ this.setData({
|
|
|
+ checkFocus: false
|
|
|
+ });
|
|
|
+ }, 500)
|
|
|
+ });
|
|
|
},
|
|
|
/**
|
|
|
* 步进器获取焦点
|
|
|
@@ -177,9 +191,9 @@ Component({
|
|
|
* 数据监听当组件被赋予value值或最小值时执行
|
|
|
* @author 刘尧
|
|
|
*/
|
|
|
- this.setData({
|
|
|
- inputValue: '-' + value || min
|
|
|
- })
|
|
|
+ this.setData({
|
|
|
+ inputValue: value * -1 || min
|
|
|
+ })
|
|
|
},
|
|
|
'inputWidth, buttonSize': function(inputWidth, buttonSize){
|
|
|
let deviceWidth = wx.getSystemInfoSync().windowWidth; //获取设备屏幕宽度
|