首页 文章

Laravel 5.3&vuejs片段实例问题

提问于
浏览
0

我正在运行一个Laravel 5.3应用程序,该应用程序支持VueJS开箱即用的webpack . 我在使用vue-multiselect时出现问题,显示:

[Vue warn]: Attribute "v-model" is ignored on component <multi-select> because the component is a fragment instance:

我正在使用vue-multiselect文档中提供的基本示例,我最终将使用它来显示表单中的国家/地区,因此是组件的名称 . 我已经尝试寻找解决方案,但Laravel 5.3似乎没有人遇到这个问题 . 我已经尝试过Laravel附带的示例组件,它运行正常 .

app.js:

Vue.component('country', require('./components/country-select.vue'));;

new Vue({
    el: 'body'
});

国家select.vue:

<template>
<div class="dropdown">
 <multi-select v-model="value" :options="options" :searchable="false" :close-on-select="false" :show-labels="false" placeholder="Pick a value"></multi-select>
 </div>
</template>

<script>
 import Multiselect from 'vue-multiselect';

export default {
  components: {
     'multi-select': Multiselect
  },
  data () {
    return {
      value: '',
      options: ['Select option', 'options', 'selected', 'mulitple', 'label', 'searchable', 'clearOnSelect', 'hideSelected', 'maxHeight', 'allowEmpty', 'showLabels', 'onChange', 'touched']
    }
  }
}
</script>

刀片文件:

<country :options="options"
    :selected.sync="selected"
    :show-label="false">
    </country>

1 回答

  • -1

    通过升级到Vue 2解决了这个问题 .

相关问题