0

所以我在 VUE-MULTISELECT 上有一个错误

这是我的代码

 <b-modal id="skills">
            <div>
                <label class="typo__label">Tagging</label>
                <multiselect v-model="value" tag-placeholder="Add this as new tag" placeholder="Search or add a tag" label="name" track-by="code" :options="options" :multiple="true" :taggable="true" @tag="addTags"></multiselect>
            </div>
            
            <template #modal-footer="{cancel}">
                    <b-button @click="cancel()"  size="sm" variant="success">
                        Add Info
                    </b-button>
            </template>
        </b-modal>

这是我的方法代码

addTags(newTag) {
                const tag = {
                    name: newTag,
                    code: newTag.substring(0, 2) + Math.floor((Math.random() * 10000000))
                }
                this.options.push(tag)
                this.value.push(tag)
            },

这是我数据上的代码

 value: [],
                options: [
                    { name: 'Vue.js', code: 'vu' },
                    { name: 'Javascript', code: 'js' },
                    { name: 'Open Source', code: 'os' },
                ],

它给了我这个错误

app.js:117759 TypeError: Cannot read property '_wrapper' of undefined
4

1 回答 1

0

感谢您的回复,很抱歉给您带来麻烦。所以问题是我拼错了我的一个方法我有一个按钮有一个@click =“联系人”但我的方法名称只是联系人。我不知道为什么它会影响多选,但它现在可以工作了,再次感谢

于 2021-02-08T06:02:01.373 回答