You need to use .number
modifier for v-model
, like this:
<input v-model.number="quantity" type="number">
Note: empty string (''
) is not converted to a number, so you may need to handle it separately.
More Related Contents:
- What should I do to use this webpacked JS library? [closed]
- Vue.js dynamic images not working
- How to add external JS scripts to VueJS Components?
- Communication between sibling components in Vue.js 2.0
- Vue.js 3 Event Bus
- [Vue warn]: Property or method is not defined on the instance but referenced during render
- Difference between the created and mounted events in Vue.js
- Filter list with Vue.js
- How to call multiple functions with @click in vue?
- How to install jQuery into Nuxt.js?
- Is there any way to ‘watch’ for localstorage in Vuejs?
- how to fix ‘Access to XMLHttpRequest has been blocked by CORS policy’ Redirect is not allowed for a preflight request only one route
- VueJS/Typescript – Cannot find module ‘./components/Navigation’ or its corresponding type declarations
- Module not found: Error: Can’t resolve vue, path not correct
- Methods vs Computed in Vue
- Vue js error: Component template should contain exactly one root element
- How to use any icons with Nuxt or Vue?
- What is ?
- Add global variable in Vue.js 3
- How to set a component non-reactive data in Vue 2?
- How do I hide the VueJS syntax while the page is loading?
- How to use Vuetify tabs with vue-router
- Styling Vuetify selectors
- CORS issue with Vue.js
- When should I use Vuex?
- Vue JS returns [__ob__: Observer] data instead of my array of objects
- VueJS conditionally add an attribute for an element
- How to use components in v-html
- Vue.js – Add class to clicked button
- Does Vue.js have a built in way to add a copy of a persistent object to a repeated array