vue 在pc端调试正常执行,移动端失败 ,页面空白

移动端对代码的执行较为严格  语句出现undefined或其他时,不报错同时页面空白 或 在created中获取不到data的值,并且不能改变data的属性

例如:

  设置memberId 时,从缓存中获取,若缓存中的userInfo为null 则移动端不报错 不执行 不能更改其值以及data中的其他属性的值

        memberId: JSON.parse(getStore("userInfo")).id,

以下为正确 执行: 

memberId: getStore("userInfo")!=null && getStore("userInfo") != "" ? JSON.parse(getStore("userInfo")).id : 9999999,

猜你喜欢

转载自www.cnblogs.com/bigsister/p/10838623.html
今日推荐