找回密码
 立即注册
搜索

storage接口使用报错

1
回复
365
查看
[复制链接]

86

主题

110

帖子

980

积分

 楼主| 2021-11-8 15:39:52 来自手机 显示全部楼层 |阅读模式
调用storage.get接口,出现报错提示,提示Cannot read property 'token' of null,请问是什么原因? storage.get({ key: 'token', success: function (data) { console.log(this.token); console.log("handling success"); }, fail: function (data, code) { console.log("handling fail, code = " + code); } })
回复

使用道具 举报

23

主题

142

帖子

825

积分

2021-11-8 16:04:05 显示全部楼层
回调函数里不能直接使用this,在调用弹窗接口前 先var that = this ,再在success中that.token
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册