首页 > 其他分享 >APP-uniapp-uni.login实现微信登陆

APP-uniapp-uni.login实现微信登陆

时间:2023-03-14 14:34:20浏览次数:28  
标签:function uniapp console log err 微信 APP uni

直接上代码

登录按钮,单击方法

weixinLogin(){
     
      console.log("进入微信登录");
      uni.login({
          provider: 'weixin',
          success: function (loginRes) {
              // 登录成功
              uni.getUserInfo({
                  provider: 'weixin',
                  success: function(info) {
                      // console.log(11111)
                      console.log(info)//用户信息
                 
                  }
              })
          },
          fail: function (err) {
                console.log(22222)
              console.log(err)
              // 登录授权失败  
              // err.code是错误码
          }
      });
      
 
 

          
        },     

如果有什么问题,及时重置开放平台密钥,重新填写到hbuiderx,重新打基座。

标签:function,uniapp,console,log,err,微信,APP,uni
From: https://www.cnblogs.com/79524795-Tian/p/17214811.html

相关文章

  • 直播平台搭建源码,uniapp progress进度条
    直播平台搭建源码,uniappprogress进度条.progress-container{height:20rpx;display:flex;flex-direction:row;align-items:center;justify-content:center;margin:......
  • 微信小程序封装一个带有图片的Tab栏
    前言最近在做一个微信小程序,看到有许多软件上都有一种带有图片可以滑动的Tab栏,然后我就去看了一些组件库,包括Vant,WeUI,发现他们所提供的Tab栏好像都只有标题(title)的功能,假......
  • 什么是SAAS微信小程序?
    SAAS小程序是一种基于云计算、软件即服务(SoftwareasaService,SAAS)的小程序。SAAS小程序提供基于云端的应用程序服务,用户可以通过互联网访问和使用这些应用程序,而不必自己......
  • 微信小程序 文字居中
    1有宽高line-height<viewclass='container'>666</view>.container{border:2rpxblacksolid;width:400rpx;height:200rpx;text-align:center;/*左右......
  • 陪诊小程序app|陪护护工系统开发|陪诊服务平台定制
     陪诊小程序应用起来非常的方便,而且用户无需下载,只要在小程序上明确的填写好自己的需求,就可以等陪诊师接单了,简单又方便,不仅智能化,而且也非常的人性化。 开发陪诊小程序......
  • uniapp/vue 生成二维码
     1、在页面中引入js文件constqrCode=require('@/assets/js/weapp-qrcode.js') 2、在页面中增加<canvasclass="canvas"canvas-id="couponQrcode"></canvas>......
  • fedora上安装netease-music-xx.appimage
    极简描述版网易云音乐外表简洁,没有广告,让人想起了千千静听。自带的音乐播放器Pragha,没有歌词,私人电台。但是在Linux上编译netease-music,依赖很多,怕搞坏系统,所以安装appim......
  • 微信小程序支付
    https://blog.csdn.net/qq_26383975/article/details/119997928(微信小程序支付大体流程)1.打开某小程序,点击直接下单。2.wx.login获取用户临时登录凭证code,发送到后端服务......
  • pc端微信扫码登录,内嵌版
    官方文档https://developers.weixin.qq.com/doc/oplatform/Website_App/WeChat_Login/Wechat_Login.html贴代码【index.html】引入wx文件<scriptsrc="https://res.wx.......
  • uniapp开发使用slot插槽时小程序编译报错:Errors compiling template:目前仅支持解构插
    1.子组件中 <view><slot:user="user">{{user.lastName}}</slot></view>2.在父组件使用<templatev-slot:default="otherSlotProps"......