I've been debugging for 8 hours trying to find out why this vue-select code is not working, but still no luck. when I run it, it show an error "option is undefined". I'm using npm to install vue-select plugin into my project. I put the following html code in my twig template. I did follow the instructions on vue-select page
<div id="myapp">
<v-select :options="myoptions" label="title">
<template slot="option" slot-scope="option">
<span class="fa" :class="option.icon"></span>
{{ option.title }}
</template>
</v-select>
</div>
Here's the rest of my js implementation code.
import Vue from 'vue';
import VueSelect from 'vue-select';
Vue.component('v-select', VueSelect)
new Vue({
el: '#myapp',
data: function () {
return {
myoptions: [
{
title: 'Read the Docs',
icon: 'fa-book',
url: 'https://codeclimate.com/github/sagalbot/vue-select'
},
{
title: 'View on GitHub',
icon: 'fa-github',
url: 'https://codeclimate.com/github/sagalbot/vue-select'
},
{
title: 'View on NPM',
icon: 'fa-database',
url: 'https://codeclimate.com/github/sagalbot/vue-select'
},
{
title: 'View Codepen Examples',
icon: 'fa-pencil',
url: 'https://codeclimate.com/github/sagalbot/vue-select'
}
]
}
}
});