Skip to content

Commit a6368c4

Browse files
committed
release wechat v0.0.1
0 parents  commit a6368c4

34 files changed

+1677
-0
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
lib
2+
node_modules
3+
package-lock.json
4+
yarn.lock
5+
tsconfig.tsbuildinfo
6+
.DS_Store
7+
*.log

.npmignore

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
lib
2+
test
3+
example
4+
docs
5+
build
6+
.github
7+
.DS_Store
8+
node_modules
9+
package-lock.json
10+
yarn.lock
11+
tsconfig.json
12+
tsconfig.tsbuildinfo
13+
src
14+
jest.config.js
15+
rollup.config.js

README.md

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# wechat
2+
3+
整合微信常用的授权、支付、分享方法。
4+
5+
## 安装
6+
7+
CDN
8+
9+
```html
10+
<script src="https://unpkg.com/@yorkjs/wechat"></script>
11+
<script>
12+
wechat.init({
13+
storage: Storage,
14+
getTimestamp: () => number,
15+
jssdkSignture: (params: SignParams) => Promise<any>,
16+
})
17+
// componentAppId 可选(第三方授权账号使用)
18+
wechat.requestAuth(state, url, appId, componentAppId)
19+
</script>
20+
```
21+
22+
NPM
23+
24+
```shell
25+
npm install @yorkjs/wechat
26+
```
27+
28+
YARN
29+
30+
```shell
31+
yarn add @yorkjs/wechat
32+
```
33+
34+
```js
35+
import wechat from '@yorkjs/wechat'
36+
37+
// 初始化
38+
wechat.init({
39+
storage: Storage,
40+
getTimestamp: () => number,
41+
jssdkSignture: (params: SignParams) => Promise<any>,
42+
})
43+
44+
// 发起微信授权 componentAppId 可选(第三方授权账号使用)
45+
wechat.requestAuth(state, url, appId, componentAppId)
46+
47+
// 解析授权返回的 state 和 code
48+
// checkRule 校验规则,可选
49+
// {
50+
// expireSeconds: 10, // 过期秒数
51+
// once: true, // 是否只读一次
52+
// }
53+
wechat.getAuthQuery(url, checkRule)
54+
```
55+
56+
## 参考微信授权文档
57+
58+
https://developers.weixin.qq.com/doc/oplatform/Third-party_Platforms/2.0/api/Before_Develop/Official_Accounts/official_account_website_authorization.html

dist/wechat.esm.js

+288
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/wechat.esm.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/wechat.esm.min.js

+2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/wechat.esm.min.js.map

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)