Created
November 10, 2017 07:56
-
-
Save wisetc/16994a6a26b438a7264454d856374149 to your computer and use it in GitHub Desktop.
Use vuejs watch feature to force the input to input Integer only and not float is allowed.
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
watch: { | |
'form.amount'(val, oldVal) { | |
if (!Number.isInteger(val)) { | |
this.$nextTick(() => { | |
this.form.amount = parseInt(val, 10) | |
}) | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment