Created
November 22, 2018 17:18
-
-
Save onefriendaday/69ebb52f1c4ad953005ec3b93d75481a 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><input class="uk-width-1-1" v-model="model.number" /></div>`, | |
| methods: { | |
| initWith() { | |
| return { | |
| plugin: 'number-plugin', | |
| number: '0' | |
| } | |
| }, | |
| pluginCreated() { | |
| console.log('plugin:created') | |
| } | |
| }, | |
| watch: { | |
| 'model': { | |
| handler: function (value) { | |
| value.number = parseInt(value.number, 10) | |
| if (isNaN(value.number)) { | |
| value.number = 0 | |
| } | |
| 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