Skip to content

Instantly share code, notes, and snippets.

@neves
Last active March 19, 2017 05:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neves/7d76d664a9479ed953a0e9c89f04e871 to your computer and use it in GitHub Desktop.
Save neves/7d76d664a9479ed953a0e9c89f04e871 to your computer and use it in GitHub Desktop.
<template lang="html">
<div class="v-tag-editor">
<v-tag-input v-model="editableTags" :separator="separator"></v-tag-input>
<v-tag-list v-model="editableTags" :theme="theme"></v-tag-list>
</div>
</template>
<script>
import VTagInput from 'v-tag-input'
import VTagList from 'v-tag-list'
export default {
name: 'v-tag-editor',
components: {VTagInput, VTagList},
props: {
value: {
type: Array,
default: () => [],
required: true
},
theme: {
type: [String, Object],
},
separator: {
type: String,
default: ' '
}
},
computed: {
editableTags: {
get () {
return this.value || []
},
set (newValue) {
var clonedValue = newValue.slice()
this.$emit('input', clonedValue)
}
}
}
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment