【vue+element】可选择,搜索,手动输入的select框
element
A Vue.js 2.0 UI Toolkit for Web
项目地址:https://gitcode.com/gh_mirrors/eleme/element
免费下载资源
·
element的select加上filterable属性后就变成可搜索的选择框,但是手动输入的值在焦点变化后会消失。加入blur事件就可以解决这个问题。其中option标签属性不添加:key的情况下options最好不要出现相同的name。
html
<template>
<el-select
v-model="content"
filterable
@blur="selectBlur"
>
<el-option
v-for="item in options"
:label="item.name"
:value="item.name"
>
</el-option>
</el-select>
</template>
js
<script>
export default{
data () {
return {
options: [
{name: 'aaa'},
{name: 'bbb'},
{name: 'ccc'}
],
content: null,
};
},
methods: {
selectBlur(e) {
this.inputContent = e.target.value
},
}
}
</script>
GitHub 加速计划 / eleme / element
54.06 K
14.63 K
下载
A Vue.js 2.0 UI Toolkit for Web
最近提交(Master分支:1 个月前 )
c345bb45
5 个月前
a07f3a59
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update transition.md
* Update table.md
* Update table.md
* Update transition.md
* Update popover.md 5 个月前
更多推荐
已为社区贡献1条内容
所有评论(0)