这里涉及到从父组件向子组件传递数据的问题,这个项目使用的是v1.0,问题是当点击了编辑以后,弹出的子组件中没有获取到父组件传过来的数据,检查后没有发现代码错误,最后解决的方法就是在父组件中,把传递的数据中的每一项都初始化了一遍就好了
creatIssue (type,list,id){this.modelIssue=true;this.modeltype=type;if(type=="creat"){ this.listdb.executorName=""; this.listdb.executorId=""; this.listdb.state=""; this.listdb.ProjVerId=""; this.listdb.content=""; this.issueTitle="创建问题至";}else if(type=="edit"){ this.listdb={...list}; // 解构数据,只用list的数值,不用list的地址 this.editId=id; this.issueTitle="编辑问题";} },这是点击编辑时执行的方法,下面是向子组件传递的数据
listdb:{executorName:"",executorId:"",state:"",ProjVerId:"",content:""},开始的时候,只是定义了一个空的数据像这样: