使用element-ui
现在,当键入“ 2 ”并按Enter时,选择“选项2”
我确实需要输入“ 1 2 4 ”并按Enter,然后选择“选项1选项2选项4”
任何想法
var Main = {
data() {
return {
options: [{
value: '1',
label: 'Option1'
}, {
value: '2',
label: 'Option2'
}, {
value: '3',
label: 'Option3'
}, {
value: '4',
label: 'Option4'
}, {
value: '5',
label: 'Option5'
}],
value: ''
}
}
}
var Ctor = Vue.extend(Main)
new Ctor().$mount('#app')
@import url("//unpkg.com/element-ui@2.11.0/lib/theme-chalk/index.css");
<script src="//unpkg.com/vue/dist/vue.js"></script>
<script src="//unpkg.com/element-ui@2.11.0/lib/index.js"></script>
<div id="app">
<template>
<el-select v-model="value" multiple filterable default-first-option placeholder="Select">
<el-option
v-for="item in options"
:key="item.value"
:label="item.label"
:value="item.value">
</el-option>
</el-select>
</template>
</div>