您好,欢迎来到尔游网。
搜索
您的当前位置:首页Error in render: “TypeError: Cannot read properties of undefined (reading ‘length‘)“ ---调取接口时的错误

Error in render: “TypeError: Cannot read properties of undefined (reading ‘length‘)“ ---调取接口时的错误

来源:尔游网

问题原因

层级太深了

<view class="input head-img">
      <text>头像</text>
      <image :src="person.headerImg" />
    </view>
	messageRequest() {
				message().then(res => {
					console.log(res.data);
					// (踩坑)Error in render: “TypeError: Cannot read properties of undefined (reading ‘length‘)“
					//层级太深了会报错--注意在template层不要层级太深---可以在这里定义多层
					this.person = res.data.userInfo;
					console.log(this.person);
				});
			}

解决方法
// (踩坑)Error in render: “TypeError: Cannot read properties of undefined (reading ‘length‘)“
//层级太深了会报错–注意在template层不要层级太深—
可以在这里定义多层

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- axer.cn 版权所有 湘ICP备2023022495号-12

违法及侵权请联系:TEL:199 18 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务