there is a business scenario, that is, I have a form form fields that are bidirectional data bound through form data objects, responsible for adding and editing items
[scene] Open the edit button, get the value from the interface, assign the content to the page, and open the new button. According to reason, you need to empty the form
. Theproblem arises, that is, when I open the form, I directly assign an empty object to the two-way bound object of the form, and the page is empty, but I have a doubt that the field bound to the page through v-model, why not report an error when I assign the form object to an empty object?
<el-form label-width="40px"><el-form-item label="" prop="">
<el-input size="small" v-model="articleForm.basicTitle"></el-input></el-form-item>
<el-form-item label="" prop="">
<el-input size="small" placeholder="" v-model="articleForm.articleAuthor" >
</el-input>
</el-form-item>
<el-form-item label="" prop="">
<el-input size="small" type="textarea" v-model="articleForm.basicDescription">
</el-input>
</el-form-item>
</el-form>
data: {
articleForm: {
basicTitle: "", //
articleAuthor: "", //
basicDescription: "", //
articleContent: "", //
},
mainArticle: {
basicPic: "", //
basicTitle: "", //
},
}
open:function (material) {
if(material && material.newsId>0){
//
}else{
//
this.articleForm = {}
this.mainArticle = {}
}
}