-
Notifications
You must be signed in to change notification settings - Fork 276
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
🐛 [Bug]: [Checkbox]组件的checked属性在非group中不生效 #1769
Comments
Title: 🐛 [Bug]: The checked attribute of the [Checkbox] component does not take effect in non-groups |
"单独的checkbox使用checked属性不生效" 单独使用的话, 建议用 v-model 绑定即可。 没必要使用checked属性。 需要讨论 |
"Using the checked attribute for a separate checkbox does not take effect" If used alone, it is recommended to use v-model binding. There is no need to use the checked attribute. Need to discuss |
@shenjunjian 场景是这样子的:我的子组件中用到了父组件传递过来的属性isChecked(在某个对象上),我需要在它改变的时候给父组件发生某个事件,直接用v-model将该属性绑定到checkbox上,就违反了Vue的单向数据流(https://cn.vuejs.org/guide/components/props.html#mutating-object-array-props)。
在使用其他组件库的时候,我是用check属性来规避这个问题的 |
我试了最新的代码, checked属性是可以正常使用了
|
I tried the latest code and the checked attribute can be used normally. I don't know what was changed. "Directly using v-model to bind this property to the checkbox violates Vue's one-way data flow." Warnings are very common in this scenario.
|
Version
latest
Vue Version
3
Link to minimal reproduction
Step to reproduce
复制到Playground中,发现设置checked为true无效
What is expected
在某些场景下,我需要对单独的checkbox使用checked属性,期望它可以生效。
What is actually happening
单独的checkbox使用checked属性不生效
What is your project name
null
Any additional comments (optional)
No response
The text was updated successfully, but these errors were encountered: