Skip to content

v-model.number not working if using :model-value and @update:model-value #8605

Discussion options

You must be logged in to vote

Use the looseToNumber function manually.

This is the same function used in the v-model directive.

<template>
  <input
    :model-value.number="currentValue"
    @update:model-value="value => currentValue = looseToNumber(value)"
  />
</template>

<script setup>
import { looseToNumber } from '@vue/shared'
</script>

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@frederikheld
Comment options

Answer selected by frederikheld
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants