I am using Vue.js and Vue-Select without node.js. I am importing them directly into my html file like so:
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/1.0.16/vue.js"></script>
<script src="https://npmcdn.com/vue-select@latest"></script>
I have a v-select menu defined in <body>
with an on-change option which should call hello()
<v-select on-change="hello" :options="['foo','bar','baz', 'asdf']"></v-select>
And the Vue-Select component is registered like this, with the hello()
method;
<script type="text/javascript">
Vue.component('v-select', VueSelect.VueSelect);
new Vue({
el: 'body',
methods: {
hello (val) {
alert(val)
}
}
});
</script>
But alas nothing happens and I get the following error message in console:
vue.js:990 [Vue warn]: Invalid prop: type check failed for onChange="hello". Expected Function, got String.
This is based on the on-change callback
event described in the vue-select documentation... but it doesn't work.
I would just like to to create an event when the select box is changed; i.e. I would like pass the value of the select box to a function which does something.