2

我正在使用 vue-multiselect 并复制了示例vue-multiselect 多选

<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>

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

在此处输入图像描述

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

  • 我尝试使用:taggable="false"
  • 我尝试使用<template #tag></template>
  • 我也检查了,标签仍然显示的不是 CSS 隐藏它。 是重现该问题的最少代码。在此处输入图像描述

Desired 行为不像示例中那样显示标记。

4

1 回答 1

5

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

于 2020-07-16T06:24:03.347 回答