小编ren*_*qot的帖子

单击带有空选项的 vue select 时,如何处理挂起的选项“抱歉,没有匹配的选项”?

我使用 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

2
推荐指数
1
解决办法
4744
查看次数

标签 统计

vue.js ×1