当前位置: 移动技术网 > IT编程>脚本编程>vue.js > vue项目中微信登录的实现

vue项目中微信登录的实现

2020年07月23日  | 移动技术网IT编程  | 我要评论
  1. 引组件 wxlogin
  2. 给组件传参
  3. 重定向的url应该是微信登录官网中的微信授权作用域
  4. 如果url里面有端口号,微信授权作用里面也要有
  5. 重定向的url:需要在http://tool.chinaz.com/tools/urlencode.aspx中转码
  6. 微信登录成功后,会自动重定向到新地址,此时的地址栏中就有code参数
  7. 如果报错说不能从组件跳到页面,那就找到wxlogin组件里面的iframe标签,加上这个属性:sandbox=“allow-scripts allow-top-navigation allow-same-origin”

报错内容:

qrconnect?scope=snsapi_login&redirect_uri=http%3a%2f%2f%2f&state=&login_type=jssdk&self_redirect=false&style=black&href=:84 Unsafe JavaScript attempt to initiate navigation 
for frame with origin 'http://localhost:9020' from frame with URL 
'https://open.weixin.qq.com/connect/qrconnect?app&scope=snsapi_login&redirect_uri=http%3a%2f%2f&state=&login_type=jssdk&self_redirect=false&style=black&href='. 
The frame attempting navigation is targeting its top-level window, but is neither same-origin with its target nor has it received a user gesture.
 See https://www.chromestatus.com/features/5851021045661696.```

本文地址:https://blog.csdn.net/my_web_advanced/article/details/107471172

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网