Last active
June 23, 2025 08:02
-
-
Save xinglongjizi/c2c44ce7c36f72f80b378cad3dc627ce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 有些场景下,我们使用el-checkbox的时候,不会通过使用v-model的方式使用它 | |
| 而是通过绑定 :checked="item.isChecked" 并配合 @change 来使用 | |
| 这时,如果 item 数据对象只变化 isChecked 属性,el-checkbox的 checked 属性不会动态变化 | |
| 可能是因为vue复用元素的问题 | |
| 解决方案 给el-checkbox加一个动态的:key = "item.isChecked ? 'filled' : 'none-fill'" | |
| 相当于强行重新渲染了el-checkbox | |
| 这样 checked属性就会随着item.isChecked变化而变化了 | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment