Created
June 13, 2018 18:45
-
-
Save techitesh/986766ec214e68b05fa5d5677685a66d to your computer and use it in GitHub Desktop.
vue-select-2-example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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