You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

73 lines
1.3 KiB

<template>
<view class="searchBg">
<view class="flex">
<view class="searchIcon">
<image src="@/static/images/searchIcon.png" mode=""></image>
</view>
<view class="inputBox">
<u-search :placeholder="placeholder" searchIcon=" " v-model="keyword" :color="'#333'"
:disabled="disable" placeholderColor="#9C9C9C" :bgColor="'transparent'"
@change="$u.debounce(searchFn, 1500)" :showAction="false" @search="$u.debounce(searchFn, 500)"
@clear="clearSearchFn"></u-search>
</view>
</view>
</view>
</template>
<script setup>
defineProps({
placeholder: {
type: String,
default: ''
},
disable: {
type: Boolean,
default: false
}
})
import {ref} from 'vue'
let emit = defineEmits()
let keyword = ref('')
function searchFn() {
emit('searchFn', keyword.value)
}
function clearSearchFn() {
keyword.value = ''
}
</script>
<style lang="scss" scoped>
image {
display: block;
width: 100%;
height: 100%;
}
.searchBg {
background: #EFEFEF;
width: 100%;
height: 72rpx;
border-radius: 10rpx;
line-height: 72rpx;
.flex {
height: 100%;
padding: 0 28rpx;
.searchIcon {
width: 32rpx;
height: 32rpx;
}
.inputBox {
flex: 1;
color: #333;
font-size: 28rpx;
margin-left: -16rpx;
}
}
}
</style>