Common methods of form attribute assignment

//方法一:
this.form['property'] = value

//方法二:
this.form = { ...this.form, property: value }

//方法三:
this.form.property = value

//方法四:
this.form = {property:value}

//方法五:
this.$set(this.form,'property',value)

Note: Method 1, Method 3, and Method 5 will have a pitfall. If this attribute is not defined in the form form in data, for the el-select tag, direct assignment will cause the verification to still exist, and the verification will not pass!

Solution: define this attribute when the form is initialized or use method 2 to assign

. . . . To be continued! Welcome to add!

Acho que você gosta

Origin blog.csdn.net/gp_911014/article/details/130823234
Recomendado
Clasificación