Last active
March 19, 2017 05:00
-
-
Save neves/7d76d664a9479ed953a0e9c89f04e871 to your computer and use it in GitHub Desktop.
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
<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