Commit 61393b48 by liangjianmin

refactor(SearchBoxWithPicker): 移除扫码功能相关代码

- 删除搜索框组件中的扫码图标点击事件及相关逻辑
- 移除不再使用的showScan属性,简化组件结构
- 优化代码可读性,提升维护性
parent 70d4dcff
Showing with 1 additions and 44 deletions
......@@ -13,7 +13,7 @@
<!-- 搜索输入框区域 -->
<view class="input-wrapper row bothSide verCenter" :class="{ 'full-width': !showPicker }">
<view class="input-content row verCenter">
<text class="search-icon iconfont icon-juxing1" @click="handleSearchIconClick"></text>
<text class="search-icon iconfont icon-juxing1"></text>
<input class="search-input" :placeholder="placeholder" :placeholder-style="placeholderStyle" :focus="inputFocus" v-model="inputValue" @input="handleInput" maxlength="-1" />
</view>
<text class="clear-icon iconfont icon-a-juxing11" @click="handleClearInput" v-if="showClearIcon || !!inputValue"></text>
......@@ -22,10 +22,6 @@
</template>
<script>
// #ifdef APP-PLUS
import { openScan } from '@/uni_modules/xtf-scanqrcode';
// #endif
export default {
name: 'SearchBoxWithPicker',
props: {
......@@ -60,10 +56,6 @@
showClear: {
type: Boolean,
default: false
},
showScan: {
type: Boolean,
default: false
}
},
data() {
......@@ -123,41 +115,6 @@
this.inputFocus = true;
}, 200);
},
/**
* 搜索图标点击事件
*/
handleSearchIconClick() {
if (!this.showScan) return;
// #ifdef APP-PLUS
openScan({
scanHintText: '请将条码/二维码对准扫描框',
fullScreenScan: true,
isShowBeep: false,
isShowVibrate: true,
isShowLightController: true,
isShowPhotoAlbum: false,
success: (type, data) => {
if (type === 0) {
this.inputValue = data;
this.showClearIcon = true;
this.$emit('update:value', data);
this.$emit('scan', data);
}
}
});
// #endif
// #ifdef MP-WEIXIN
uni.scanCode({
success: (res) => {
var data = res.result;
this.inputValue = data;
this.showClearIcon = true;
this.$emit('update:value', data);
this.$emit('scan', data);
}
});
// #endif
}
}
};
</script>
......
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 sign in to comment