0.1.0
Mac/Google Chrome 69
2.5.17
https://jsfiddle.net/rztdvn1e/
1.为el-form-item添加prop验证器;
2.通过v-if表达式逻辑判断el-form-item是否显示;
3.当v-if为真时,显示el-form-item;
4.验证器不起作用;
通过v-if逻辑判断的时候,希望条件为真时,验证器依然起效;
通过v-if逻辑判断的时候,希望条件为真时,验证器不起效;
Translation of this issue:
Element UI version
0.1.0
OS/Browsers version
Mac/Google Chrome 69
Vue version
2.5.17
Reproduction Link
https://jsfiddle.net/rztdvn1e/
Steps to reproduce
when V-IF is true, display el-form-item;
verifier does not work.
What is Expected?
When V-IF logic is used, the verifier still works when the desired condition is true.
What is actually happening?
When the V-IF logic is judged, the verifier will not work when the desired condition is true.
页面地址中,需要点击【即时配送】的switch进行切换条件真假
还是元素复用的问题, display为true的时候上面的el-form-item复用了原来的, 并没有重新从头渲染, 所以prop也没传递进去. 设置不同的key就可以.
https://jsfiddle.net/rztdvn1e/1/
参考用 key 管理可复用的元素
@coffeeyen 谢谢你,确实是这样的,第一次遇到这个问题。
@coffeeyen 的方案可行。👍
看到你在许多 issue 下回答问题,如果对维护 Element 感兴趣,可以联系我。
Most helpful comment
还是元素复用的问题, display为true的时候上面的el-form-item复用了原来的, 并没有重新从头渲染, 所以prop也没传递进去. 设置不同的key就可以.
https://jsfiddle.net/rztdvn1e/1/
参考用 key 管理可复用的元素