Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
453 views
in Technique[技术] by (71.8m points)

elementUI表单Object.assign处理后无法编辑?

this.form = {};
Object.assign(this.form, this.tableData[index - 1]);//此时表单无法编辑
this.form= Object.assign({}, this.tableData[index - 1]);//这时可编辑

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

vue2对于新增的属性不能实现监听。

上面的代码是设置form为空对象,然后监听这个空对象,最后用assign为这个空对象添加属性,这样是监听不到的。

下面的代码是声明一个空对象,然后为这个未向添加属性,然后把这个对象赋值给form,最后系统监听这个对象。

vue-注意事项


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...