刚学习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()
}
},
有没有人有相似的问题,求解答。
0 个回复