@demoskp You are using vue package but try to solve with .js file?
In multiselect.vue
<template>
<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="addTag"></multiselect>
</template>
<script>
import Multiselect from 'vue-multiselect'
export default {
components: {
Multiselect
},
data () {
return {
value: [
{ name: 'Javascript', code: 'js' }
],
options: [
{ name: 'Vue.js', code: 'vu' },
{ name: 'Javascript', code: 'js' },
{ name: 'Open Source', code: 'os' }
]
}
},
methods: {
addTag (newTag) {
const tag = {
name: newTag,
code: newTag.substring(0, 2) + Math.floor((Math.random() * 10000000))
}
this.options.push(tag)
this.value.push(tag)
}
},
}
</script>
In app.js
Vue.component('multi', require('./multi.vue').default);
//shouldn't same name with multiselect.It will be overwritten package's component and will be error Maximum call stack size exceeded
var app = new Vue({
el: '#app', //BTW you forgot in vue instance
mixins: [require('spark')],
});
You can call in blade
<div id="app">
<multi></multi>
</div>