我使用 vue-select 创建选择选项。但是,我对 vue-select 为空时的行为有疑问,它显示消息“抱歉,没有选项匹配”。
HTML 代码:
<div id="app">
<h1>Vue Select - Custom Labels</h1>
<v-select label="countryName" :options="options"></v-select>
</div>
Run Code Online (Sandbox Code Playgroud)
CSS代码:
body {
font-family: 'Source Sans Pro', 'Helvetica Neue', Arial, sans-serif;
}
h1 {
font-size: 26px;
font-weight: 600;
color: #2c3e5099;
text-rendering: optimizelegibility;
-moz-osx-font-smoothing: grayscale;
-moz-text-size-adjust: none;
}
#app {
max-width: 30em;
margin: 1em auto;
}
Run Code Online (Sandbox Code Playgroud)
JS代码:
Vue.component("v-select", VueSelect.VueSelect);
new Vue({
el: "#app",
data: {
options: null
}
});
Run Code Online (Sandbox Code Playgroud)
https://codepen.io/sagalbot/pen/aEjLPB
制作一个数据,选项:null
下拉菜单将显示消息“抱歉,没有匹配的选项”。单击该选项,下拉选择将挂起。
我预计 dropdwon 选择会在选择“抱歉,没有匹配的选项”时关闭。
vue.js ×1