参考:uniapp页面参数传递_wwf1225的博客-CSDN博客_uniapp参数
关键就是一点:onLoad的是参数传值,传参时会把参数字段的值强制转换成string,否则在接收的时候的强制转换成对象
null 转换成字符串 “null ” false 转换成字符串 “false” 必须通过JSON.parse解析成对象
if (option) {
this.initUsername = JSON.parse(option["username"]) || "";
console.log("this.initUsername======", option, this.initUsername, typeof this.initUsername, Boolean(this.initUsername));
this.disableUsername = Boolean(this.initUsername);
}
注意:JSON.parse只能解析一些特殊的字符串或json专用字符串,否则会报语法错误!!!!!