时间:2021-02-19 15:21:35 | 栏目:vue | 点击:次
vue属性传递时有时会报下述错误
vue.esm.js?f959:610 [Vue warn]: Error in render: "TypeError: Cannot read property 'RegistrationAuthority' of undefined" found in ---> <DialogHistory> at src/components/tools/dialog_history.vue <NurseInfor> at src/components/router_components/nurse_infor/nurse_infor.vue <Index> at src/components/index.vue <App> at src/App.vue <Root>
子组件中接收的数据为data
props:["data"],
data的实际格式为
data:{ "xxx":{}, "yyy":{}, }
父元素传递的时候没有写入内部对象只有
data:{}
所以会显示找不到所以在传递的时候直接赋上内部的对象就好了
data(){ return { data:{ "FirstRegistration":{}, "RegistrationOfChange":{}, "ContinuedRegistration":{}, } }
如果传入的是别的类型比如数组也声明上类型
data(){ return { data:[] } }