index.html中引入
–登录页
html
<div id="ding-login" class="a"></div>
import qs from 'qs'
// 钉钉后台获取的appid和appSecret,appSecret没有用到扫码中
let appid= 'XXXXXXXXXXX'
let redirect = encodeURIComponent(`xxxxxxxxxxxxxx`) //回调地址
let http_url = encodeURIComponent(`https://oapi.dingtalk.com/connect/oauth2/sns_authorize?appid=${
appid}&response_type=code&scope=snsapi_login&prompt=consent&state=STATE&redirect_uri=${
redirect}`)
data中实例
code: qs.parse(window.location.hash.substring(3)).code, // 获取的临时登陆码
codeX:'',
方法
created(){
this.ddLoginInit()
this.