如何写精华回答,获更多曝光?
发布
接口:
export interface userInfo{
address:string
age:number
avatar:string
flag:string
id:number
nickname:string
password:string
phone:string
sex:string
username:string
}
调用用户首选项:
async aboutToAppear(){
this.vv = await preferencesUtil.getKey("myPreferences", 'userInfo', 'unknowns') as userInfo
console.log('aboutToAppear==',this.vv)
console.log('this.vv.avatar==',this.vv.avatar)
}
log:
aboutToAppear== {"id":-1,"username":"未登录","password":"","age":-1,"sex":"-","nickname":"-","address":"-","phone":"-","avatar":'aaa',"flag":"1"}
this.vv.avatar== undefind