当前位置:网站首页>Avoid mutating a prop directly since the value will be overwritten whenever the parent component

Avoid mutating a prop directly since the value will be overwritten whenever the parent component

2022-07-07 11:08:00 Have a good time I

First, let's look at the page error
 Insert picture description here
In fact, the problem is very simple, the problem of parent-child components passing values ;
 Insert picture description here
The code of sub components is also very simple
 Insert picture description here

Parent component :
 Insert picture description here
 Insert picture description here
problem : Press save without error , Press cancel to report the error shown above .
And find out why , Principle should Vue Reasons for single data flow , Can't modify at will props In the value of the , Then why can I save this function without reporting errors ?? Both of my calls are the same function ?
Really a little confused !
But I still solved the problem
 Insert picture description here

I put v-model Instead of :visible, In this way, there is no error in saving or canceling
I haven't figured out the specific reason , Should be ant-design-Vue The reason for the underlying design

原网站

版权声明
本文为[Have a good time I]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202130619539905.html