Last active
July 23, 2022 16:53
-
-
Save SebbeJohansson/9a6b863e3a3cfc0a79df457b0392b5d5 to your computer and use it in GitHub Desktop.
A storyblok datetime field with a default value for today.
This file contains 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 = { | |
template: ` | |
<div> | |
<div class="image__wrap uk-margin-small-bottom"> | |
<input type="datetime-local" id="date" name="date" v-model="model.date"> | |
</div> | |
</div> | |
`, | |
mixins: [window.Storyblok.plugin], | |
methods: { | |
initWith() { | |
return { | |
plugin: 'date-time-today-default', | |
date: new Date().toISOString(), | |
} | |
}, | |
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