Files
hht-tongbo-two/components/SearchBoxMx.vue

75 lines
1.5 KiB
Vue
Raw Normal View History

2024-04-25 14:29:54 +08:00
<template>
<view class="zd-row scan_wraper">
2024-05-13 16:41:17 +08:00
<input
type="text"
class="zd-col-24 search_input"
confirm-type="go"
:value="value"
:focus="focusState"
@focus="handleFocus"
@blur="handleBlur"
@confirm="handleSend"
@tap="handleFocus">
<uni-icons v-show="value.length" class="mgr20" type="clear" size="24" color="#666" @tap="toDel"></uni-icons>
<uni-icons type="scan" size="22" :color="focusState ? '#D7592F' : '#666'" @tap="focusState=true"></uni-icons>
2024-04-25 14:29:54 +08:00
</view>
</template>
<script>
import permision from "@/utils/permission.js"
export default {
2024-05-13 16:41:17 +08:00
data() {
return {
focusState: false
};
},
model: {
prop: 'value',
event: 'input'
},
2024-04-25 14:29:54 +08:00
props: {
2024-05-13 16:41:17 +08:00
value: String
2024-04-25 14:29:54 +08:00
},
methods: {
2024-05-13 16:41:17 +08:00
handleFocus () {
this.focusState = true
setTimeout(() => {
uni.hideKeyboard()
}, 300)
2024-04-25 14:29:54 +08:00
},
2024-05-13 16:41:17 +08:00
handleBlur (e) {
this.$emit('input', e.target.value)
if (e.target.value.length) {
this.$emit('handleChange', e.target.value)
2024-04-25 14:29:54 +08:00
}
2024-05-13 16:41:17 +08:00
this.focusState = false
},
toDel () {
this.$emit('input', '')
},
handleSend (e) {
this.$emit('input', e.target.value)
if (e.target.value.length) {
this.$emit('handleChange', e.target.value)
2024-04-25 14:29:54 +08:00
}
}
}
}
</script>
2024-05-11 17:37:01 +08:00
<style lang="stylus" scoped>
2024-04-25 14:29:54 +08:00
@import '../common/style/mixin.styl';
.scan_wraper
2024-04-25 14:29:54 +08:00
position relative
_wh(100%, 80rpx)
border: 1px solid #dcdfe6;
background-color: #fff;
border-radius: 10rpx;
padding: 0 10rpx
2024-04-25 14:29:54 +08:00
.search_input
2024-05-13 16:41:17 +08:00
height 80rpx;
_font(28rpx, 80rpx, #606266,,)
border: 0;
background-color: transparent;
2024-04-25 14:29:54 +08:00
</style>