私はVueを初め、このチュートリアルのコードを改善しました。Vue-Multiselectの "Undefined"グループラベル?
しかし、私はこの "未定義"グループ名の問題に直面しています。
の.html:
<multiselect
v-model="value"
:options="options"
:multiple="true"
track-by="name"
:hide-selected="true"
:custom-label="customLabel"
:searchable="false"
placeholder=""
group-values="details"
group-label="groupDivision"
>
</multiselect>
の.jsは:
new Vue({
components: {
Multiselect: VueMultiselect.default
},
data: {
value: { groupDivision: 'Government',
name: 'Fish',
contact: '[email protected]' },
options: [
{
groupDivision: 'Governemnt',
details:[
{ name: 'Fish', contact: '[email protected]' },
{ name: 'Police', contact: '[email protected]' },
{ name: 'Society', contact: '[email protected]' }
]
},
{
groupDivision: 'Media',
details:[
{ name: 'BBC', contact: '[email protected]' },
{ name: 'CNN', contact: '[email protected]' },
{ name: 'CBC', contact: '[email protected]' }
]
},
]
},
methods: {
customLabel (option) {
return `${option.name}`
}
}
}).$mount('#app')
私はすでに "グループ・ラベル" を設定しましたが、それはまだ "未定義" を示しています。
誰もが問題を抱えていますか?前もって感謝します!コードへ
リンク: https://codepen.io/dennis-leeyinghui/pen/VzybrR
ブリリアント!ありがとう!!!!!!!!!!!!! –
ここにあなたのサンプルを移動しました。動作しています:https://jsfiddle.net/pqjww0me/8/ – kevguy