0

laravel project with vue.i install all thing in app js to work v-select, i don't know anyhting is missing in installation or not.if something is missing tell me that or somthing is wrong in v-select tag please help if anyone is experienced such a thing

on app.js-----------------------------------------------------------------


require('./bootstrap');

window.Vue = require('vue');

import VueRouter from 'vue-router'
import Cat from './components/dashboard/category/Category.vue';
import Sub from './components/dashboard/sub-category/sub-category.vue'; 
import Dash from './components/dashboard/Dashboard.vue';
import VueToast from 'vue-toast-notification';
import Vuetify from 'vuetify';
import 'vuetify/dist/vuetify.min.css';
import VModal from 'vue-js-modal';
// import Vue from 'vue';
import vSelect from 'vue-select';
import 'vue-select/dist/vue-select.css';

// Import one of available themes
import 'vue-toast-notification/dist/theme-default.css';
import { Form, HasError, AlertError } from 'vform';

window.Form = Form;


 
// import {routers} from './routers';
Vue.use(Vuetify)
Vue.use(VueToast); 
Vue.use(VueRouter);
Vue.use(VModal);
// Vue.use(vSelect)
Vue.component('v-select', vSelect)
const routes = [
    
    { path: '', component: Dash },
    { path: '/category', component: Cat },
    { path: '/sub-category', component: Sub },
  ]
const router = new VueRouter({
    routes
})

const app = new Vue({
    el: '#app',
    router,
    vuetify: new Vuetify()
});


on component--------------------------------------------------------------------------------

 <v-select  v-model="select"  :items="categories" label="Select" item-text="name"  item-value="id" return-object> </v-select>



export default {
  data(){
    return {
        form: new Form({
            name:'',
            imgUrl:'',
            remember: false
      }),
      categories:[],
      select: 'Select',
    }
  },

  mounted(){
   this.getCategories() 
  },
  methods:{
    getCategories(){
      axios.get('sub-category')
      .then(res => (
        res.data.forEach((value, index) => {
            this.categories.push(value);
        })
     ));
    }
  }
}


1 Answers1

0

Should the items property in the v-select tag not be called options? Source: https://vue-select.org/guide/options.html#options-prop

Hannah
  • 1,123
  • 6
  • 5