2024-04-25 14:29:54 +08:00
|
|
|
<template>
|
2024-05-13 14:36:24 +08:00
|
|
|
<view class="zd-row scan_wraper">
|
2024-04-25 14:29:54 +08:00
|
|
|
<input
|
|
|
|
|
type="text"
|
2024-05-13 14:36:24 +08:00
|
|
|
class="zd-col-24 search_input"
|
|
|
|
|
confirm-type="go"
|
2024-04-25 14:29:54 +08:00
|
|
|
:value="value"
|
|
|
|
|
:focus="focusState"
|
2024-05-13 14:36:24 +08:00
|
|
|
@focus="handleFocus"
|
|
|
|
|
@blur="handleBlur"
|
|
|
|
|
@confirm="handleSend">
|
|
|
|
|
<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 {
|
|
|
|
|
data() {
|
|
|
|
|
return {
|
|
|
|
|
focusState: false
|
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
model: {
|
|
|
|
|
prop: 'value',
|
|
|
|
|
event: 'input'
|
|
|
|
|
},
|
|
|
|
|
props: {
|
|
|
|
|
value: String,
|
|
|
|
|
focused: {
|
|
|
|
|
type: Boolean,
|
|
|
|
|
default: false
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
watch: {
|
|
|
|
|
focused() {
|
|
|
|
|
this.focusState = this.focused
|
|
|
|
|
},
|
|
|
|
|
},
|
|
|
|
|
mounted () {
|
|
|
|
|
if (this.focused) {
|
|
|
|
|
this.focusState = true
|
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
2024-05-13 14:36:24 +08:00
|
|
|
handleFocus () {
|
|
|
|
|
this.focusState = true
|
2024-04-25 14:29:54 +08:00
|
|
|
},
|
2024-05-13 14:36:24 +08:00
|
|
|
handleBlur (e) {
|
|
|
|
|
this.$emit('input', e.target.value)
|
2024-05-13 16:41:17 +08:00
|
|
|
if (e.target.value.length) {
|
|
|
|
|
this.$emit('handleChange', e.target.value)
|
|
|
|
|
}
|
|
|
|
|
this.focusState = false
|
2024-04-25 14:29:54 +08:00
|
|
|
},
|
|
|
|
|
toDel () {
|
|
|
|
|
this.$emit('input', '')
|
|
|
|
|
},
|
2024-05-13 14:36:24 +08:00
|
|
|
handleSend (e) {
|
|
|
|
|
this.$emit('input', e.target.value)
|
2024-05-13 16:41:17 +08:00
|
|
|
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';
|
2024-05-13 14:36:24 +08:00
|
|
|
.scan_wraper
|
2024-04-25 14:29:54 +08:00
|
|
|
position relative
|
|
|
|
|
_wh(100%, 80rpx)
|
2024-05-13 14:36:24 +08:00
|
|
|
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 14:36:24 +08:00
|
|
|
height 80rpx;
|
|
|
|
|
_font(28rpx, 80rpx, #606266,,)
|
|
|
|
|
border: 0;
|
|
|
|
|
background-color: transparent;
|
2024-04-25 14:29:54 +08:00
|
|
|
</style>
|