Skip to content

Instantly share code, notes, and snippets.

@onefriendaday
Created February 11, 2019 09:26
Show Gist options
  • Save onefriendaday/068d0ac0b1d41e498cb531ceed5bcb51 to your computer and use it in GitHub Desktop.
Save onefriendaday/068d0ac0b1d41e498cb531ceed5bcb51 to your computer and use it in GitHub Desktop.
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