Created
November 20, 2018 14:27
-
-
Save onefriendaday/3bbed56c70f7b94227d87def0154637b 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> | |
<div v-if="modalIsOpen">Modal is open</div> | |
<div v-if="!modalIsOpen">Modal is closed</div> | |
<a @click="doOpen">Open modal</a> | |
<a @click="doClose">Close modal</a> | |
<select v-model="options"><option value="1"></option></select> | |
</div>`, | |
data() { | |
return { | |
modalIsOpen: false, | |
option: '1' | |
} | |
}, | |
methods: { | |
initWith() { | |
return { | |
plugin: 'example_plugin', | |
example: 'Hello world!' | |
} | |
}, | |
doOpen() { | |
this.$emit('toggle-modal', true) | |
this.modalIsOpen = true | |
}, | |
doClose() { | |
this.$emit('toggle-modal', false) | |
this.modalIsOpen = false | |
}, | |
pluginCreated() { | |
console.log('plugin:created') | |
} | |
}, | |
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