Skip to content

Instantly share code, notes, and snippets.

@wisetc
Created November 10, 2017 07:56
Show Gist options
  • Select an option

  • Save wisetc/16994a6a26b438a7264454d856374149 to your computer and use it in GitHub Desktop.

Select an option

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.
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