洛阳学员端
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.
 
 
 
 
 

90 lines
1.7 KiB

<template>
<view class="searchBg" :style="{background: `${bg}`}">
<view class="flex">
<view class="searchIcon">
<image src="@/static/images/icon/searchIcon.png" mode=""></image>
</view>
<view class="inputBox">
<view class="isDisable" v-if="disable" @click="searchFn">{{ placeholder }}</view>
<u-search v-else :placeholder="placeholder" v-model="keyword" :color="'#333'" placeholderColor="#CCCCCC" :disabled="disable" @click="searchFn" :bgColor="'transparent'" @change="$u.debounce(searchFn, 1500)" :showAction="false" @search="$u.debounce(searchFn, 500)" @clear="clearSearchFn"></u-search>
</view>
</view>
</view>
</template>
<script>
export default {
// props: ['placeholder', 'disable', 'bg'],
props: {
placeholder: {
type: String,
default: ''
},
disable: {
type: Boolean,
default: false
},
bg: {
type: String,
default: '#fff'
}
},
data() {
return {
keyword: ''
}
},
methods: {
searchFn() {
this.$emit('searchFn', this.keyword)
},
clearSearchFn() {
this.keyword = ''
}
}
}
</script>
<style lang="scss" scoped>
.searchBg {
width: 100%;
height: 72rpx;
border-radius: 16rpx;
line-height: 72rpx;
.flex {
height: 100%;
padding: 0 28rpx 0 0;
.searchIcon {
width: 52rpx;
height: 52rpx;
margin: 0 -24rpx 0 12rpx;
}
.inputBox {
flex: 1;
color: #fff;
font-size: 24rpx;
}
}
}
.textColor {
font-size: 26rpx;
color: #fff;
line-height: 72rpx;
padding-left: 14rpx;
}
.isDisable {
height: 62rpx;
background: #FFFFFF;
border-radius: 20px;
font-size: 28rpx;
color: #ccc;
line-height: 62rpx;
padding-left: 40rpx;
}
</style>