1.0.3 • Published 4 years ago

xhswxlogin v1.0.3

Weekly downloads
-
License
ISC
Repository
-
Last release
4 years ago

安装

npm install xhswxlogin

使用

在public/index.html引入

<script src="http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>

在main.js导入

import weChatLogin from 'xhswxlogin'
import 'xhswxlogin/xhsWxLogin.css'

Vue.use(weChatLogin)

在需要使用的页面

<weChatLogin ref="weChatLogin" :loginParams="loginParams"></weChatLogin>

loginParams是微信扫码登录所需要的参数

示例

self_redirect: true,
id: "login_container",
appid: "1111111",
scope: "snsapi_login",
redirect_uri: "1111111",
state: "1111111"

使用示例

public/index.html

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0">
    <link rel="icon" href="<%= BASE_URL %>favicon.ico">
    <script src="http://res.wx.qq.com/connect/zh_CN/htmledition/js/wxLogin.js"></script>
</head>

main.js

import weChatLogin from 'xhswxlogin'
import 'xhswxlogin/xhsWxLogin.css'

Vue.use(weChatLogin)

index.vue

<template>
  <div class="main">
  	<weChatLogin ref="weChatLogin" :loginParams="loginParams"></weChatLogin>
  </div>
</template>
1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago