已解决
复制代码<view class="searchButtonList">
<image class="searchIcon" src="../../static/images/icon/ic-sousuo.png" mode=""></image>
<input class="searchInput" placeholder="搜索" v-model="searchValue" auto-focus :focus="searchFocus" @blur="searchBlur()" @input="searchDelShow"/>
<image class="delIcon" v-if="searchDelButTag" src="../../static/images/icon/ic-del.png" @click="searchDelBut()"></image>
</view>
复制代码/是否显示搜索叉叉
searchDelShow(event){
console.log(event.detail.value.length)
if(event.detail.value.length > 0){
this.searchDelButTag = true;
}else{
this.searchDelButTag = false;
}
},
searchBlur(){
this.searchFocus = false;
},
searchDelBut(){
this.searchValue = "";
var _this = this;
setTimeout(function(){
_this.searchFocus = true;
},500)
},
1 个回复
龙九山 (作者)
已解决
复制代码
<view class="searchButtonList"> <image class="searchIcon" src="../../static/images/icon/ic-sousuo.png" mode=""></image> <input class="searchInput" placeholder="搜索" v-model="searchValue" auto-focus :focus="searchFocus" @blur="searchBlur()" @input="searchDelShow"/> <image class="delIcon" v-if="searchDelButTag" src="../../static/images/icon/ic-del.png" @click="searchDelBut()"></image> </view>
复制代码
/是否显示搜索叉叉 searchDelShow(event){ console.log(event.detail.value.length) if(event.detail.value.length > 0){ this.searchDelButTag = true; }else{ this.searchDelButTag = false; } }, //搜索框光标离开事件 searchBlur(){ this.searchFocus = false; }, //搜索框×按钮的点击事件 searchDelBut(){ // console.log('搜索框×按钮的点击事件'); this.searchValue = ""; var _this = this; setTimeout(function(){ _this.searchFocus = true; },500) },