Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export default function Index () {
const [state, events, loading, error] = usePage(init)
const dispatch = useDispatch()
useMount(() => {
// 获取用户信息
Taro.getSetting({
success: res => {
if (res.authSetting['scope.userInfo']) {
// 已经授权,可以直接调用 getUserInfo 获取头像昵称,不会弹框
Taro.getUserInfo({
success: result => {
events.saveUserInfo(result.userInfo, dispatch)
},
fail: err => console.warn(err),
})
}
},
})
export default function Index () {
const [state, events, loading] = usePage(init)
const dispatch = useDispatch()
useDidShow(() => {
events.initData(dispatch)
})
return (