Commit 2ab4f80d by 岑成威

fix: 限制表情输入

1 parent 09aa324c
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
</view> </view>
<template v-if="componentObject[popupType] && !componentObject[popupType].hideSearch"> <template v-if="componentObject[popupType] && !componentObject[popupType].hideSearch">
<view class="popup-search"> <view class="popup-search">
<input class="input" type="text" :placeholder="(componentObject[popupType] && componentObject[popupType].placeholder) || '请输入'" placeholder-class="placeholder" v-model="componentObject[popupType].searchValue" confirm-type="search" @confirm="handleSearch" /> <input class="input" type="text" :placeholder="(componentObject[popupType] && componentObject[popupType].placeholder) || '请输入'" placeholder-class="placeholder" v-model="componentObject[popupType].searchValue" confirm-type="search" @input="onSearchValueInput" @confirm="handleSearch" />
<view class="clear flex" @click="clear"> <view class="clear flex" @click="clear">
<uni-icons type="closeempty" size="16" v-if="componentObject[popupType] && componentObject[popupType].searchValue"></uni-icons> <uni-icons type="closeempty" size="16" v-if="componentObject[popupType] && componentObject[popupType].searchValue"></uni-icons>
</view> </view>
...@@ -256,6 +256,15 @@ export default { ...@@ -256,6 +256,15 @@ export default {
popupType: 12 popupType: 12
}, true) }, true)
}, },
onSearchValueInput (e) {
const filtered = (e.detail.value || '').replace(
/(\ud83c[\udf00-\udfff])|(\ud83d[\udc00-\ude4f\ude80-\udeff])|(\ud83e[\udd00-\uddff])|[\u2600-\u26FF]|[\u2700-\u27BF]|[\uFE0F]/gi,
''
)
this.$nextTick(() => {
this.$set(this.componentObject[this.popupType], 'searchValue', filtered)
})
},
clear () { clear () {
this.componentObject[this.popupType].searchValue = '' this.componentObject[this.popupType].searchValue = ''
this.handleSearch() this.handleSearch()
......
<template> <template>
<view class="order-management"> <view class="order-management">
<view class="search-box"> <view class="search-box">
<input class="search-input" placeholder-class="placeholder" v-model="keyword" confirm-type="search" @confirm="search" placeholder="输入客户姓名/商品名称/订单编号/手机号搜索" /> <input class="search-input" placeholder-class="placeholder" v-model="keyword" confirm-type="search" @input="onKeywordInput" @confirm="search" placeholder="输入客户姓名/商品名称/订单编号/手机号搜索" />
<view class="clear flex" @click="clear"> <view class="clear flex" @click="clear">
<uni-icons type="closeempty" size="16" v-if="keyword"></uni-icons> <uni-icons type="closeempty" size="16" v-if="keyword"></uni-icons>
</view> </view>
...@@ -237,6 +237,15 @@ export default { ...@@ -237,6 +237,15 @@ export default {
this.clearWaitOrderPolling() this.clearWaitOrderPolling()
}, },
methods: { methods: {
onKeywordInput(e) {
const filtered = (e.detail.value || '').replace(
/(\ud83c[\udf00-\udfff])|(\ud83d[\udc00-\ude4f\ude80-\udeff])|(\ud83e[\udd00-\uddff])|[\u2600-\u26FF]|[\u2700-\u27BF]|[\uFE0F]/gi,
''
)
this.$nextTick(() => {
this.keyword = filtered
})
},
clear() { clear() {
this.keyword = '' this.keyword = ''
this.search() this.search()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!