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

使用了v2.3.0的v-region组件在我的vue2.6+的版本中,v-region组件使用:disabled绑定一个变量,当那个变量变化时,v-region组件的禁用状态不会发生改变 #64

Open
MomentRing opened this issue Nov 9, 2023 · 3 comments

Comments

@MomentRing
Copy link

我是用了v2.3.0的v-region组件在我的vue2.6+的版本中,v-region组件使用:disabled绑定一个变量,当那个变量变化时,v-region组件的禁用状态不会发生改变,查看组件最外层的disabled已经同步发生改变了,但内部的下拉框的disabled无变化

@MomentRing
Copy link
Author

我将v-region组件放在el-form中的el-form-item中

@MomentRing
Copy link
Author

解决了需要给组件设置个key,每次更新状态也更新key就能刷新状态了

@TerryZ
Copy link
Owner

TerryZ commented Nov 10, 2023

这是 vue2 系列依赖注入无法现实响应式的典型问题

解决办法是触发组件的重新渲染,有这么几种办法

  • refs.refName.$forceUpdate()
  • 绑定并更换一个 key 值
  • 使用 v-if 进行切换

vue 2 的版本或许会考虑不使用依赖注入的方式解决该问题

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

No branches or pull requests

2 participants