tencent-wx-jssdk
v1.4.7
Published
微信 JS-SDK
Downloads
58
Maintainers
Readme
tencent-wx-jssdk
Weixin JS-SDK
This is lib not maintain anymore, please use [@types/jweixin](https://www.npmjs.com/package/@types/jweixin)
instead.
SDK Version
1.6.0
Install
npm install tencent-wechat-jssdk --save
How to Use
TypeScript
// sometime you want import this module, eg. use this with webpack
import { scanQRCode } from 'tencent-wx-jssdk';
scanQRCode({
needResult: 0,
scanType: ['qrCode'],
success(res) {
console.log(res);
}
});
or, you could add this module in your tsconfig.json
{
"compilerOptions": {
"types": [
"tencent-wx-jssdk"
]
}
}
then use it freely.
jWeixin.scanQRCode({
needResult: 0,
scanType: ['qrCode'],
success(res) {
console.log(res);
}
});
// sometimes you must use WeixinJSBridge, like wexin paying
WeixinJSBridge.invoke("getBrandWCPayRequest", {}, (res) => {
});
javascript
You will need this only if you would like get your project packed.
const wx = require('tencent-wx-jssdk');
wx.scanQRCode({
needResult: 0,
scanType: ['qrCode'],
success(res) {
console.log(res);
}
});
Others
ts Error
If you get this Error:
[ts] Initializers are not allowed in ambient contexts.
Try add "skipLibCheck": true
to compilerOptions
in file tsconfig.json
.
Good luck!