You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
161 lines
5.3 KiB
161 lines
5.3 KiB
// 使用 |
|
// 在页面中引用 |
|
// import inputBlur from '../../mixin/inputBlur.js' |
|
// 然后在中 |
|
// export default { |
|
// mixins:[inputBlur], |
|
// } |
|
|
|
// <input type="text" :focus="oneFocus" @input="oneInputBlur" v-model="oneInput" class="uni-input-border" placeholder=""> |
|
// <input type="number" v-model="twoInput" @input="twoInputBlur" class="uni-input-border" placeholder=""></input> |
|
// <input type="number" v-model="therrInput" @input="therrInputBlur" class="uni-input-border" placeholder=""></input> |
|
|
|
// oneInputData(){}, |
|
// twoInputData(){}, |
|
// therrInputBlur(){}, |
|
// 创建一个需要混入的对象 |
|
|
|
export default { |
|
data() { |
|
return { |
|
time: null, |
|
oneInput: '', |
|
oldOneInput: '', |
|
twoInput: '', |
|
oldTwoInput: '', |
|
therrInput: '', |
|
oldTherrInput: '', |
|
fourInput: '', |
|
oldFourInput: '', |
|
oneInputFcous: true, |
|
twoInputFcous: false, |
|
therrInputFcous: false, |
|
fourInputFcous: false, |
|
fiveInputFcous: false, |
|
} |
|
}, |
|
|
|
methods: { |
|
clearFcous() { |
|
this.twoInputFcous = false |
|
this.therrInputFcous = false |
|
this.fourInputFcous = false |
|
this.fiveInputFcous = false |
|
this.oneInputFcous = true |
|
}, |
|
clearAllFcous() { |
|
this.twoInputFcous = false |
|
this.therrInputFcous = false |
|
this.fourInputFcous = false |
|
this.fiveInputFcous = false |
|
this.oneInputFcous = false |
|
}, |
|
clearOneInput() { |
|
this.oneInput = '' |
|
this.oldOneInput = '' |
|
}, |
|
clearTwoInput() { |
|
this.twoInput = '' |
|
this.oldTwoInput = '' |
|
}, |
|
clearTherrInput() { |
|
this.therrInput = '' |
|
this.oldTherrInput = '' |
|
}, |
|
clearFourInput() { |
|
this.fourInput = '' |
|
this.oldFourInput = '' |
|
}, |
|
clearInput() { |
|
this.oneInput = '' |
|
this.oldOneInput = '' |
|
this.twoInput = '' |
|
this.oldTwoInput = '' |
|
this.therrInput = '' |
|
this.oldTherrInput = '' |
|
this.fourInput = '' |
|
this.oldFourInput = '' |
|
}, |
|
oneInputBlur(e) { |
|
// uni.hideKeyboard() |
|
clearTimeout(this.time) |
|
if (e.detail.value.length == 0) { |
|
this.oldOneInput = '' |
|
this.oneInput = e.detail.value |
|
} |
|
if (e.detail.value.length < this.oldOneInput.length) { |
|
this.oneInput = e.detail.value |
|
this.oldOneInput = this.oneInput |
|
return |
|
} |
|
this.time = setTimeout(() => { |
|
if (this.oneInput.length >= 1) { |
|
this.oneInput = e.detail.value.slice(this.oldOneInput.length) |
|
this.oldOneInput = this.oneInput |
|
this.oneInputData(this.oneInput) |
|
} |
|
}, 1500); |
|
}, |
|
twoInputBlur(e) { |
|
// uni.hideKeyboard() |
|
console.log(e); |
|
clearTimeout(this.time) |
|
if (e.detail.value.length == 0) { |
|
this.oldTwoInput = '' |
|
this.twoInput = e.detail.value |
|
} |
|
if (e.detail.value.length < this.oldTwoInput.length) { |
|
this.twoInput = e.detail.value |
|
this.oldTwoInput = this.twoInput |
|
return |
|
} |
|
this.time = setTimeout(() => { |
|
if (this.twoInput.length >= 1) { |
|
this.twoInput = e.detail.value.slice(this.oldTwoInput.length) |
|
this.oldTwoInput = this.twoInput |
|
this.twoInputData(this.twoInput) |
|
} |
|
}, 1500); |
|
}, |
|
therrInputBlur(e) { |
|
// uni.hideKeyboard() |
|
clearTimeout(this.time) |
|
if (e.detail.value.length == 0) { |
|
this.oldTherrInput = '' |
|
this.therrInput = e.detail.value |
|
} |
|
if (e.detail.value.length < this.oldTherrInput.length) { |
|
this.therrInput = e.detail.value |
|
this.oldTherrInput = this.therrInput |
|
return |
|
} |
|
this.time = setTimeout(() => { |
|
if (this.therrInput.length >= 1) { |
|
this.therrInput = e.detail.value.slice(this.oldTherrInput.length) |
|
this.oldTherrInput = this.therrInput |
|
this.therrInputData(this.therrInput) |
|
} |
|
}, 1500); |
|
}, |
|
fourInputBlur(e) { |
|
// uni.hideKeyboard() |
|
clearTimeout(this.time) |
|
if (e.detail.value.length == 0) { |
|
this.oldFourInput = '' |
|
this.fourInput = e.detail.value |
|
} |
|
if (e.detail.value.length < this.oldFourInput.length) { |
|
this.fourInput = e.detail.value |
|
this.oldFourInput = this.fourInput |
|
return |
|
} |
|
this.time = setTimeout(() => { |
|
if (this.fourInput.length >= 1) { |
|
this.fourInput = e.detail.value.slice(this.oldFourInput.length) |
|
this.oldFourInput = this.fourInput |
|
this.fourInputData(this.fourInput) |
|
} |
|
}, 1500); |
|
}, |
|
} |
|
} |