Browse Source

搜索组件 添加清空按钮

master
邓宏 2 years ago
parent
commit
735ce5235f
  1. 6
      uni_modules/d-search/components/d-search/d-search.vue

6
uni_modules/d-search/components/d-search/d-search.vue

@ -19,6 +19,11 @@
input{ input{
flex-grow: 1; flex-grow: 1;
} }
.plant-zengjia{
transform: rotate(45deg);
color:#999;
padding:6rpx;
}
.u-button{ .u-button{
flex-shrink: 0; flex-shrink: 0;
width:max-content; width:max-content;
@ -88,6 +93,7 @@
<view class="search" @click.stop=""> <view class="search" @click.stop="">
<u-icon name="search" color="#999999" size="20"/> <u-icon name="search" color="#999999" size="20"/>
<input placeholder="请输入搜索内容" :value="(list.find(v=>v.value==value)||{label:''}).label||value" auto-blur @focus="isShow=true" @input="$emit('input',$event.detail.value)" @confirm="isShow=false;$emit('search')"/> <input placeholder="请输入搜索内容" :value="(list.find(v=>v.value==value)||{label:''}).label||value" auto-blur @focus="isShow=true" @input="$emit('input',$event.detail.value)" @confirm="isShow=false;$emit('search')"/>
<text class="plant-zengjia" v-if="value" @click="$emit('input','');$emit('search')"/>
<u-button type="primary" shape="circle" v-if="list.length<=0" color="#10C176" text="搜索" size="mini" @click="$emit('search')"/> <u-button type="primary" shape="circle" v-if="list.length<=0" color="#10C176" text="搜索" size="mini" @click="$emit('search')"/>
</view> </view>
<view v-if="list.length>0" @click.stop="" class="want_search card" :class="{show:isShow}"> <view v-if="list.length>0" @click.stop="" class="want_search card" :class="{show:isShow}">

Loading…
Cancel
Save