说实话,Iview UI真的挺坑的,官方文档什么都没说,当Iview UI中Select 加了filterable属性,在加了remote和:remote-method="接口搜索函数"远程搜索功能之后,不管接口有没有数据,“无匹配数据“永远在显示。
<!--cityList 不论是否存在数据,"无匹配数据"总是莫名其妙的显示-->
<Select v-model="model11" filterable>
<Option v-for="item in cityList" :value="item.value" :key="item">
{{ item.label }}
</Option>
</Select>
有效的解决方法
not-found-text iview.github.io/components/…
<!--暂时没看源码,只能人为操作not-found-text-->
<Select v-model="model11" filterable remote
:not-found-text="cityList.length===0?'':'无匹配数据'"
:remote-method="remoteMethod" :loading="loading"
>
<Option v-for="item in cityList" :value="item.value" :key="item">
{{ item.label }}
</Option>
</Select>