Created
October 8, 2018 20:58
-
-
Save DominikAngerer/f8fa330ae078a7bde22761815f593279 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 class="uk-grid"> | |
| <div class="uk-width-1-5" v-if="has_image"> | |
| <img :src="model.src"/> | |
| </div> | |
| <div :class="{ 'uk-width-4-5': has_image, 'uk-width-1-1': !has_image }" > | |
| <input class="uk-width-1-1" placeholder="Your image URL" v-model="model.src" /> | |
| </div> | |
| </div> | |
| <sb-asset-selector :uid="uid" field="src"></sb-asset-selector> | |
| </div>`, | |
| computed: { | |
| has_image() { | |
| return this.model.src !== '' | |
| } | |
| }, | |
| methods: { | |
| initWith() { | |
| return { | |
| plugin: 'imagefieldtest', | |
| src: '' | |
| } | |
| }, | |
| 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