Iview Select filterable搜索“无匹配数据”一直显示,Iview Select filterable远程搜索“无匹配数据”显示异常

拓展 https://blog.csdn.net/weixin_44132981/article/details/102607979?utm_medium=distribute.pc_relevant.none-task-blog-baidujs_baidulandingword-0&spm=1001.2101.3001.4242

说实话,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 https://iview.github.io/components/select#API

<!--暂时没看源码,只能人为操作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>

 

 

posted @ 2021-05-27 23:42  天渺工作室  阅读(886)  评论(0编辑  收藏  举报