关于iview:Iview-Select-filterable远程搜索无匹配数据显示异常

拓展 https://blog.csdn.net/weixin_…

说实话,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/compo…

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

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

这个站点使用 Akismet 来减少垃圾评论。了解你的评论数据如何被处理