Fix:3765 【商城小程序】新增收货地址采用文本识别,从中间长按删除,会跳到文本最后面进行删除。
This commit is contained in:
@@ -32,7 +32,8 @@
|
|||||||
<view class="address-analysis-wrap">
|
<view class="address-analysis-wrap">
|
||||||
<view class="inp">
|
<view class="inp">
|
||||||
<textarea
|
<textarea
|
||||||
v-model.trim="addressInput"
|
:value="addressInput"
|
||||||
|
@input="handleAddressInput"
|
||||||
placeholder="请粘贴收件人手机号、姓名、收货地址并用空格区分,系统将自动识别地址信息"
|
placeholder="请粘贴收件人手机号、姓名、收货地址并用空格区分,系统将自动识别地址信息"
|
||||||
placeholder-style="font-size:24rpx;color:#C2C5CC;"
|
placeholder-style="font-size:24rpx;color:#C2C5CC;"
|
||||||
class="inp-textarea"
|
class="inp-textarea"
|
||||||
@@ -126,6 +127,12 @@ export default {
|
|||||||
this.getUserAddress()
|
this.getUserAddress()
|
||||||
this.getCityList()
|
this.getCityList()
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
// 清除定时器,避免内存泄漏
|
||||||
|
if (this.inputTimer) {
|
||||||
|
clearTimeout(this.inputTimer);
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
getIndex(value, arr) {
|
getIndex(value, arr) {
|
||||||
var idx = -1
|
var idx = -1
|
||||||
@@ -141,6 +148,17 @@ export default {
|
|||||||
if (!this.addressInput) return
|
if (!this.addressInput) return
|
||||||
this.addressInput = ''
|
this.addressInput = ''
|
||||||
},
|
},
|
||||||
|
handleAddressInput(e) {
|
||||||
|
// 清除之前的定时器
|
||||||
|
if (this.inputTimer) {
|
||||||
|
clearTimeout(this.inputTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 设置新的定时器,延迟300ms执行
|
||||||
|
this.inputTimer = setTimeout(() => {
|
||||||
|
this.addressInput = e.target.value.trim();
|
||||||
|
}, 300);
|
||||||
|
},
|
||||||
// 识别
|
// 识别
|
||||||
distinguishHandle() {
|
distinguishHandle() {
|
||||||
if (!this.addressInput) return
|
if (!this.addressInput) return
|
||||||
|
|||||||
Reference in New Issue
Block a user