Tag Archives: Vue warn

[Vue warn]: Error in render: “TypeError: Cannot read properties of undefined


e.g.

<div>{{obj.name}}</div>
<div>{{obj.info.access_control}}</div>

data(){
	return {
		obj:{}
	}
}

The data format of template rendering is obj.name or obj.info.access_ Control, why does obj.name not report the above dislocation and obj.info.access_ The above error will appear in control. Because obj data has not been requested from the back end to assign its value, the obj object is still an empty object. Without the attribute info, obj.info is naturally undefined, and then undefined.access_ Control will naturally report the above error.

Solution: add info null object in obj object

data(){
	return {
		obj:{
			info:{}
		}
	}
}