Skip to content
欢迎扫码关注公众号

微信小程序 API wx.authorize 中的 scope.userInfo 被废弃

微信废弃了 wx.authorize 接口中的 scope.userInfo 权限scope

而如果没有用 button 组件授权过,wx.getUserInfo 调用接口返回失败。

这意味着,用户未授权的情况下,无法在程序启动时自动弹出用户授权的提示框,只能改为用户手动点击按钮触发授权。

详见微信团队公告 获取用户信息接口优化调整

小程序中授权按钮示例:

xml
<button wx:if="{{!hasUserInfo && canIUse}}" open-type="getUserInfo" bindgetuserinfo="getUserInfo" class='bg-primary text-white'> 微信登录 </button>
<button wx:else class='bg-primary text-white' bindtap="redirectToBlog"> 进入博客 </button>

Page Layout Max Width

Adjust the exact value of the page width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the page layout
A ranged slider for user to choose and customize their desired width of the maximum width of the page layout can go.

Content Layout Max Width

Adjust the exact value of the document content width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the content layout
A ranged slider for user to choose and customize their desired width of the maximum width of the content layout can go.