Created
February 11, 2019 09:26
-
-
Save onefriendaday/068d0ac0b1d41e498cb531ceed5bcb51 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
const Fieldtype = { | |
mixins: [window.Storyblok.plugin], | |
template: `<div> | |
<select v-model="model.value"> | |
<option :key="tag.name" :value="tag.name" v-for="tag in tags">{{tag.name}}</option> | |
</select> | |
</div>`, | |
data() { | |
return { | |
tags: [] | |
} | |
}, | |
methods: { | |
initWith() { | |
return { | |
plugin: 'taglist', | |
value: '' | |
} | |
}, | |
pluginCreated() { | |
this.api | |
.get('cdn/tags') | |
.then((res) => { | |
this.tags = res.data.tags | |
}) | |
} | |
}, | |
watch: { | |
'model': { | |
handler: function (value) { | |
this.$emit('changed-model', value); | |
}, | |
deep: true | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment