Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A checkbox with :checked="true" ( controlled checkbox ) doesn't work #6084

Closed
CarterLi opened this issue Jun 9, 2022 · 1 comment
Closed

Comments

@CarterLi
Copy link
Contributor

CarterLi commented Jun 9, 2022

Vue version

3.2.27

Link to minimal reproduction

https://sfc.vuejs.org/#eyJBcHAudnVlIjoiPHRlbXBsYXRlPlxuICA8aW5wdXQgdHlwZT1cImNoZWNrYm94XCIgOmNoZWNrZWQ9XCJ0cnVlXCIgLz5cbjwvdGVtcGxhdGU+IiwiaW1wb3J0LW1hcC5qc29uIjoie1xuICBcImltcG9ydHNcIjoge1xuICAgIFwidnVlXCI6IFwiaHR0cHM6Ly9zZmMudnVlanMub3JnL3Z1ZS5ydW50aW1lLmVzbS1icm93c2VyLmpzXCIsXG4gICAgXCJ2dWUvc2VydmVyLXJlbmRlcmVyXCI6IFwiaHR0cHM6Ly9zZmMudnVlanMub3JnL3NlcnZlci1yZW5kZXJlci5lc20tYnJvd3Nlci5qc1wiXG4gIH1cbn0ifQ==

Steps to reproduce

<template>
  <input type="checkbox" :checked="true" />
</template>

What is expected?

The checkbox should be always checked because prop checked is always true

What is actually happening?

The checkbox is unchecked after I click it

System Info

N/A

Any additional comments?

The same behavior for

  1. <input value.prop="test" />
  2. <input type="range" :value.prop="10" />

Nothing works

@Justineo
Copy link
Member

Justineo commented Jun 9, 2022

It’s expected as Vue doesn’t support fully controlled native inputs. There’s already an RFC about this here.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants