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>

 

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM