1.2.5 • Published 4 years ago

fwing_wx_sdk_a_s v1.2.5

Weekly downloads
2
License
ISC
Repository
github
Last release
4 years ago

Preparation

Installation

$ npm i fwing_wx_sdk_a_s

Start Coding

Import

In page coding:

import FWing from "fwing_wx_sdk_a_s";
let fwing = new FWing({
    jsApiList,
    requesturl
});
paramNameDescriptiontypeisRequiredexample
jsApiListwhich JS-API you used in this page. Availablearraytrue"chooseImage", "uploadImage"
requesturlOn the premise of that your Developer-Server's accessible url is http://www.aaa.com/aaa/index.html. When instance FWing, if you don't define this param, fetch(http://www.aaa.com/aaa/n/wxsdk_jssdj_config). But if you define to "http(s)://xxx.xxx.com/xxx", fetch(http(s)://xxx.xxx.com/xxx/n/wxsdk_jssdj_config).stringfalse"http(s)://xxx.xxx.com/xxx"

Essentially, this npm-package is the encapsulation of AJAX request realized by javascript fetch method.

You will use happily when you use Vue or React project.

chooseImage

jsApiList = ["chooseImage", "uploadImage"];

This api will return a text which means the picture name like 'xxx.png'

If you want to request the image you take just now, request the below url:

http(s)://xxx.xxx.com/xxx/images/xxx.png

And the usage is below:

fwing.chooseImage((res) => {
    this.imgsrc = requesturl + "/images/" + res;
}, requesturl);
// requesturl need you define like 'http(s)://xxx.xxx.com/xxx'

scanQRCode

jsApiList = ["scanQRCode"];

And the usage is below:

fwing.scanQRCode(0);
// param 0: The scanning results are processed by wechat
fwing.scanQRCode(1, (res) => {
    console.log(res);
    this.scanQRCodeValue = res;
});
// param 1: The scan result is returned directly, and the user can obtain the scan result through the parameter res in the scanQRCodeFn callback and perform other operations

chooseWXPay

jsApiList = ["chooseWXPay"];
fwing.chooseWXPay("Test header: fw test pay", 1, (res) => {
        this.chooseWXPayCallback = "fontend success callback's data: " + JSON.stringify(res); 
    }, requesturl);
// param 'Test header: fw test pay': describe the title of you wechat pay
// param 1: define how much money you will pay for (unit: ¥0.01)

chooseWXPayNSH

jsApiList = ["chooseWXPay"];
fwing.chooseWXPayNSH(
    {{
        "goods_desc": "****费",
        "list": [
            {
                "id": "1",
                "trade_amount": "0.01"
            },
            {
                "id": "2",
                "trade_amount": "0.02"
            }
        ]
    }},
    (res) => {
        console.log(res);
    },
    requesturl
);

Thanks!

1.2.5

4 years ago

1.2.4

4 years ago

1.2.3

4 years ago

1.2.2

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.9

4 years ago

1.1.8

4 years ago

1.1.7

4 years ago

1.1.6

5 years ago

1.1.5

5 years ago

1.1.4

5 years ago

1.1.3

5 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.9

5 years ago

1.0.8

5 years ago

1.0.7

5 years ago

1.0.6

5 years ago

1.0.5

5 years ago

1.0.4

5 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago