Skip to content

Instantly share code, notes, and snippets.

@SebbeJohansson
Last active July 23, 2022 16:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save SebbeJohansson/9a6b863e3a3cfc0a79df457b0392b5d5 to your computer and use it in GitHub Desktop.
Save SebbeJohansson/9a6b863e3a3cfc0a79df457b0392b5d5 to your computer and use it in GitHub Desktop.
A storyblok datetime field with a default value for today.
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