vue使用prop可以渲染但是打印台报错问题

vue属性传递时有时会报下述错误

vue.esm.js?f959:610 [Vue warn]: Error in render: "TypeError: Cannot read property 'RegistrationAuthority' of undefined"

found in

--->  at src/components/tools/dialog_history.vue
        at src/components/router_components/nurse_infor/nurse_infor.vue
          at src/components/index.vue
            at src/App.vue
             

子组件中接收的数据为data

props:["data"],

data的实际格式为

data:{
"xxx":{},
"yyy":{},
}

父元素传递的时候没有写入内部对象只有

data:{}

所以会显示找不到所以在传递的时候直接赋上内部的对象就好了

      data(){
          return {
            data:{
               "FirstRegistration":{},
               "RegistrationOfChange":{},
               "ContinuedRegistration":{},
            }
          }

如果传入的是别的类型比如数组也声明上类型

     data(){
          return {
            data:[]
            }
          }

你可能感兴趣的:(vue,vue,prop)