javascript - 如何在 vue-multiselect 中没有标签?

标签 javascript vue.js vue-multiselect

我正在使用 vue-multiselect 并复制了示例 vue-multiselect multiple select

<div>
  <label class="typo__label">Simple select / dropdown</label>
  <multiselect v-model="value" :options="options" :multiple="true" :close-on-select="false" :clear-on-select="false" :preserve-search="true" placeholder="Pick some" label="name" track-by="name" :preselect-first="true">
    <template slot="selection" slot-scope="{ values, search, isOpen }"><span class="multiselect__single" v-if="values.length &amp;&amp; !isOpen">{{ values.length }} options selected</span></template>
  </multiselect>
  <pre class="language-json"><code>{{ value  }}</code></pre>
</div>

在示例中可以看到标签不存在,这在所有示例中都会发生,默认情况下标签在任何示例中都不存在。

enter image description here

但是当使用示例代码时,标签确实显示了,

  • 我尝试使用 :taggable="false" ,
  • 我尝试使用 <template #tag></template>
  • 我也检查过,不是CSS隐藏的 标签仍在显示。 enter image description here Here它是重现问题的最少代码。

期望的行为不会像示例中那样显示标记。

最佳答案

你应该使用 <template slot="tag">{{ '' }}</template>隐藏标签。

关于javascript - 如何在 vue-multiselect 中没有标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62927900/

相关文章:

javascript - 将所有发布数据发送到 Jquery AJAX

javascript - 如何限制vue中NUMBER输入的最大数量?

vue.js - buefy 中的 Font Awesome 图标

javascript - 使用 VuejS 在 v-model 中传递对象

css - Bootstrap overflow y 表动态高度问题

javascript - onclick 对里面的元素做一些事情

JavaScript 对话框返回

vue.js - 使用 vue-multiselect 将对象数组从 vue 传递到 laravel

javascript - 如何使用 styled-components 将 Gatsby 链接组件的填充设置为 0px

javascript - Vue 中的 componentWillReceiveProps