-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Description
Prerequisites
- I have read the Contributing Guidelines.
- I agree to follow the Code of Conduct.
- I have searched for existing issues that already report this problem, without success.
Ionic Framework Version
- v4.x
- v5.x
- v6.x
- Nightly
Current Behavior
The string is returned to the model instead of the number.
Expected Behavior
The nnumber is returned to the model if type="number".
Steps to Reproduce
<template>
<ion-input type="number" v-model="itemQty" inputmode="numeric"></ion-input>
</template>
<script lang="ts">
export default defineComponent({
setup() {
const qty = ref<number>(1);
watch(qty, (value) => {
console.log(typeof value)
})
return {
qty
}
}
})
</script>
Code Reproduction URL
No response
Ionic Info
Ionic:
Ionic CLI : 6.18.1 (/usr/local/lib/node_modules/@ionic/cli)
Ionic Framework : @ionic/vue 6.1.0
Capacitor:
Capacitor CLI : 3.4.0
@capacitor/android : 3.4.0
@capacitor/core : 3.4.3
@capacitor/ios : 3.4.0
Utility:
cordova-res : 0.15.4
native-run : 1.5.0
System:
NodeJS : v14.17.4 (/usr/local/bin/node)
npm : 8.7.0
OS : macOS Monterey
Additional Information
I have found similar issues on Github but all of them related to Angular and not Vue, also they are 3-4 years old.
The current workaround will be to use watchers and parseFloat the value, however i do not see it is a great workaround as the model updated twice, and the types also not respected so the result could be unexpected