Skip to content

Input with type="number" does not update value after removing leading zeros from v-model binding #10615

Closed
@Dzelix

Description

@Dzelix

Vue version

3.2.37

Link to minimal reproduction

https://play.vuejs.org/#eNqNU8tyEzEQ/JUpXbxOGa8pOBk7xcuHcAAq5IY4bLwTR2H1QBotNq79d0ZaP4JDUtnTqqfV06OWtuKdc+M2opiKWVh65QgCUnTn0ijtrCfYgsdqSapF6ODGWw0D5g+kkWZpTSC4tvXmEn/B/EAsttIA62i1WDvlsf6ITbWZwmSUcHyAdcOj2vIWlz9Zq2iHMD+HrNRXTNSMu8oHvDBU7Np+b3+M4OVk+CYRyxLoVgXeUCPUFgMYS0BeaWiwqpVZwR/0Cc+DKOMiQVs1EdPuoyL3mWTBfyA2wOCDPkk+PEe/PHukSzorulIabaSiOM6dvlMHCe9GsBv4rEyGOmlmZZ8e58YLQu2aipBXALPeRi9IG4dzKVjoGr0UO7R9oXmShgu7duPT8KTomW+zGBNzTsXglDcY7plaGaZNpCjZxay8Z0mMBAXO9EatxnfBGr57eVwWtdqpBv0XR4ozl2K6Pwgpqqaxvz9ljHzEfJXynmTkP/hdWCdMiq8eA/oWpTjUqPIrpL68+PYZ1/x/KPJRxIbZTxQvMdgmJo897X00Ndu+x8tuL/IL4ltxFRZrQhP2QyWjfZD93PygPjwx+tHuq/HrvI8zF91fADo9Yg==

Steps to reproduce

  1. Write from keyboard one ore more leading zeroes into input like 000123.

What is expected?

Value inside the input should be shown without leading zeroes.

What is actually happening?

Value in reactive bodyReq is without leading zeroes, however inside input it is shown with leading zeroes.

System Info

System:
    OS: macOS 14.3.1
    CPU: (8) arm64 Apple M1
    Memory: 53.63 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - /usr/local/bin/node
    npm: 10.1.0 - /usr/local/bin/npm
    bun: 0.5.8 - /usr/local/bin/bun
  Browsers:
    Chrome: 123.0.6312.86
    Safari: 17.3.1

Any additional comments?

If we put bodyReq[v] = num inside settimeout function it works.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions