Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/corePublic

Empty string gets coerced to true when Boolean is first in type array #14216

Open
@rudyxu1102

Description

@rudyxu1102

Vue version

3.5.25

Link to minimal reproduction

https://play.vuejs.org/#__PROD__eNp9Us1O8zAQfJWVLwWpSg7fd4oiJEA9wAEQIC6YQ0g2bcDxWv4pQVXfnbXTBJCAmz0zXs/O7k6cGpNtA4pClK62nfHg0AdzInXXG7IedmCxhT20lnpYsHQxU+fUmwOe5fESKzFd5mMpLsIXj71RlUe+AZRRdlImNQNl/oUVS+FdTbrt1tmLI82edvGNFDWrO4X22viOtJOigMRErlKK3i4T5m3A5YTXG6xff8Bf3BAxKW4sOrRblGLmfGXX6Ed6dXeFA59nsqcmKFb/Qd6iIxWix1F2FnTDtr/oktuLFF+n1/duNXjUbmoqGo3KfdJLwXHGoH5r/dPuv+x/eif1nlOcRhGH+j39ptumA8AG2Qm8kVVNYvKR+jYQvs6DxCGNvMG2Coq3Ij4yloyb/bRE8xnAvxss4PGMSGGll3DnLTe8hKvQP6N9OgQCU8ECFrw4EeAepgB6Ctpjc3Q8lc1zWA0GawYLeKhU4C+kkALu028u/TFLT2sfKjULY7gH4fPoalTyxvHUMFO0PvKbzmXcyPGUZgphWmex/wA/JQyI

Steps to reproduce

  1. Define a prop with type: [Boolean, String, Number] (Boolean listed first)
  2. Set a default value of empty string: default: ''
  3. Pass an empty string value to the component:
  4. Check the received prop value in the component

What is expected?

When passing value="", the component should receive:

  • this.value === "" (empty string)
  • typeof this.value === "string"

What is actually happening?

When Boolean is the first type in the array, Vue incorrectly coerces the empty string "" to true:

  • this.value === true
  • typeof this.value === "boolean"

System Info

Any additional comments?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp