Use vue with element UI as the query area. Due to two-way data binding, select always displays the initialized value directly during initialization without displaying the value in the placeholder, as shown in the figure:
But the background default is to query all without parameters. If you change all the values to other values, the data will not be queried, which is embarrassing! !
Please ask God to solve it!
<p class="search-area m-t-md">
<p class="header clearfix">
<h3 class="text">仓库管理</h3>
<span class="btn-text" @click="modalShow = true"><i class="icon-plus"></i>添加仓库</span>
</p>
<p class="inner">
<el-input v-model="searchInfo.houseCode" placeholder="请输入仓库编码或名称"></el-input>
<el-select v-model="searchInfo.houseType" placeholder="请选择仓库类型">
<el-option value="" label="全部"></el-option>
<el-option value="1" label="总店"></el-option>
<el-option value="2" label="门店"></el-option>
</el-select>
<el-select v-model="searchInfo.storeNo" placeholder="请选择所属门店">
<el-option value="" label="全部"></el-option>
<el-option v-for="store in storeLists" :key="store.storeNo" :value="store.storeNo" :label="store.storeName"></el-option>
</el-select>
<el-button type="primary" @click="getDepotLists">查询</el-button>
</p>
</p>
<script type="text/ecmascript-6">
import {mapState} from 'vuex'
export default {
name: 'depot',
data () {
return {
searchInfo:{
method:'cn.linkea.mshop.houseFacade.findPageList',
chainCode:'',
createOperator:'',
houseCode:'',
houseName:'',
houseType:'',
pageIndex:'1',
pageSize:'10',
storeManager:'',
storeName:'',
storeNo:'',
updateOperator:''
}
}
}
}
</script>
巴扎黑2017-06-24 09:45:25
You can do this
<el-option value="all_list" label="all"></el-option>
<script>
if ( this.searchInfo.houseType === 'all_list' ) {
this.searchInfo.houseType='';
}
</script>
Personal opinion, for reference
曾经蜡笔没有小新2017-06-24 09:45:25
The first methodsearchInfo.houseType
Initial value setting null
The second method<el-option value="-1" label="All"></el-option>
or <el-option value="-1" label="All"></el-option>
When sending a request, manually omit the value of -1 or 0!