Skip to content

Instantly share code, notes, and snippets.

@techitesh
Created June 13, 2018 18:45
Show Gist options
  • Save techitesh/986766ec214e68b05fa5d5677685a66d to your computer and use it in GitHub Desktop.
Save techitesh/986766ec214e68b05fa5d5677685a66d to your computer and use it in GitHub Desktop.
vue-select-2-example
const app = new Vue({
el: '#app',
data() {
return {
users: [
{ id: 1, text: '[email protected]' },
{ id: 2, text: '[email protected]' },
],
}
},
watch: {
user() {
this.updateUsers();
}
},
mounted() {
$(this.$refs.user_select).select2({data: this.users})
.on('change',this.updateUsers)
.select2('val','2')
},
methods: {
updateUsers(e) {
console.log(e.target.value);
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment