vue.js - Vue中如何在ui-select菜单中显示搜索项
问题描述
有什么方法可以将我的搜索项显示到ui-select
vue 的菜单中?例如,如果用户在搜索字段中输入,例如在模糊事件中或在输入时,它会将项目显示到ui-select
菜单中:
因此,例如在上图中,“测试”一词显示在突出显示的字段中。到目前为止我所做的如下,但无法达到我的目标。
<ui-select
v-model="groupName"
has-search
@blur="hello"
@query-change="checkEvent"
></ui-select>
方法:
checkEvent(val) {
this.groupName = val;
//but this one is not displayed in my field, like it's remain on the search field.
}
有什么办法可以做到吗?
解决方案
所以我使用了最新的Keen-ui 和Vue 的CDN 使它工作。
这是笔:https ://codepen.io/anon/pen/rKLjbr
<div id="app">
<ui-select
has-search
label="Favourite colours"
placeholder="Select some colours"
v-model="item"
:options="colours"
@query-change="checkEvent"
></ui-select>
</div>
<script>
new Vue({
el: '#app',
data() {
return {
item: '',
colours: ['red', 'violet']
}
},
methods: {
checkEvent (val) {
console.log(val)
this.item = val // this will automatically update and be outputted in the highlighted field in your screenshot.
}
}
});
</script>
推荐阅读
- tensorflow - 展平张量流数据集中的图像元组
- r - 如何设置文本以在工具提示上显示货币(使用 plot_ly 而不是 ggplotly)?
- c# - 在 C# 中使用 If else 升序排列 5 个数字
- android - Expo Eject 后,run-android 错误:spawnSync gradlew.bat Enoent
- python - python代码中的问题[configparser.InterpolationSyntaxError:'%'必须后跟'%'或'(',找到:'%']使用带有appium的python 3.7.3
- r - 如何创建与列交叉的指标向量?
- python - 将 .xlsx 文件导入模型,收到 DateField 的 Integer out of range 错误:行号:1 - integer out of range
- java - 如何为控制器中的许多方法添加权限检查?(过滤器,动作)
- reactjs - 如何将旧的 react-router HashRouter(带有#)重定向到 BrowserRouter?
- python - sklearn LogisticRegression.predict 中缺少概率