Created
February 27, 2017 13:34
-
-
Save neves/d3db343a4d91ede65e668de4beee45a9 to your computer and use it in GitHub Desktop.
Vue.js tag editor component: https://medium.com/@marcosneves/vue-js-tip-5-tag-editor-component-418d4e926b71
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
Vue.component('tag-editor', { | |
template: `<div class="tag-editor"> | |
<tag-input v-model="editableValue"></tag-input> | |
<tag-list v-model="editableValue"></tag-list> | |
</div>`, | |
props: ['value'], | |
computed: { | |
editableValue: { | |
get () { | |
return this.value || [] | |
}, | |
set (val) { | |
this.$emit('input', val.slice()) | |
} | |
} | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment