getUserProfile 无法在setTimeout调用吗?是我的方法写错了么?

小程序 文章 2022-03-17 10:40 0 全屏看文

getUserProfile 无法在setTimeout调用吗?是我的方法写错了么?Can't getUserProfile be called at setTimeout? Is my method wrong?

getUserProfile 无法在setTimeout调用吗?是我的方法写错了么?

onLoad() {

    setTimeout(() => {

    console.log("-------setTimeout-----")

    wx.getUserProfile({

        desc: '展示用户信息', // 声明获取用户个人信息后的用途,后续会展示在弹窗中,请谨慎填写

        success: res => {

          console.log("--------getUserProfile------",res)

        }

      })

    }, 3000);

  }

}

Onload() {setTimeout (() = > {console.log ("-------- setTimeout ----") wx.getuserprofile ({desc: 'display user information', / / declare the purpose of obtaining the user's personal information, which will be displayed in the pop-up window later. Please fill in success: res = > {console.log ("-------- getuserprofile ----", RES)})}, 3000);}}

回答:

社区技术运营专员-Jahozheng:

Mr.Zhao:

得用点击事件触发,你写错了

-EOF-