我正在动态创建允许多项选择的 vue-select 下拉列表。但是这些下拉列表允许选择相同的选项。如何在不使用 v-model 的情况下更改此行为(因为我正在动态创建这些列表)?
选项:
"categories": [
{
"id": 1,
"name": "Math",
"years": [
{ "id": 14, "name": "4" },
{ "id": 15, "name": "5" },
{ "id": 16, "name": "6" }
]
},
{
"id": 2,
"name": "Science",
"years": [
{ "id": 11, "name": "1" },
{ "id": 12, "name": "2" },
{ "id": 13, "name": "3" }
]
}
]
HTML:
<div
v-for="category in categories">
<label>{{category.name}}</label>
<vue-select
:options="category.years"
label="name"
@input="onCategoryYearSelect"
multiple>
</vue-select>
</div>