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