<template>
<view>
<view slot="default" class="search_box">
<text class="icon_search"></text>
<input style="width: 280px;" :value="searchName" class="prompt" placeholder="请输入员工姓名" @input="theBlur"></input>
<text v-if="searchName" class="icon_close" @click="close">clear</text>
</view>
</view>
</template>
<script>
export default {
data() {
return {
searchName:""
}
},
methods: {
close:function(){
this.searchName = ''
},
theBlur(e){
console.log(e.target.value)
this.searchName = e.target.value
}
}
}
</script>
<style>
.search_box {
width: 400upx;
height: 64upx;
background-color: #f5f5f5;
border-radius: 32upx;
display: flex;
align-items: center;
padding: 0upx 40upx;
.prompt {
font-size: 28upx;
color: #cccccc;
}
}
.icon_search {
background-color: #0000FF;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
width: 32upx;
height: 28upx;
margin-right: 20upx;
}
.icon_close {
background-color: #74273b;
background-position: center center;
background-repeat: no-repeat;
background-size: cover;
width: 32upx;
height: 28upx;
margin-right: 10upx;
}
</style>