3***@qq.com
3***@qq.com
  • 发布:2024-10-16 10:51
  • 更新:2024-10-16 10:51
  • 阅读:141

运行在微信开发者工具中出现Error: [fun]: data is not defined,找了好久都不知道哪里出问题了?

分类:HBuilderX

刚学习uniapp,写登录功能的过程运行在微信小程序开发者工具出现Error: [fun]: data is not defined,在HBuilderX中的内置浏览器显示的错误是

{errMsg: "login:fail method 'uni.login' not supported"}
errMsg: "login:fail method 'uni.login' not supported"
可是data已经定义
data() {
return {
content: '',
list: [],
}
},
onLoad() {
let token = uni.getStorageSync('token');//get token
if (!token) {//if there is no token
uni.login().then(({code})=>{//use a code from the third side to log in
uniCloud.callFunction({
name: 'fun',
data: {
api: 'loginWithMp',
code
}
}).then(({result})=>{
token = result.token;
uni.setStorageSync('token', token)
this.getList()
})
})
} else {
this.getList()
}
},
有没有人有相似的问题,求解答。

2024-10-16 10:51 负责人:无 分享
已邀请:

要回复问题请先登录注册