1. 千牛 Mobile SDK

千牛 Mobile 应用平台(Qianniu Application Platform)前端开发 SDK。

1.1. 2.x 版本重大变更

  • QN.ajax 新接口。支持方便快捷地进行异步请求。
  • QN.fetch 升级。不再支持 mode: jsonpdataType 参数。 JSONP 接口请使用 QN.ajax
  • QN.mtop 升级,详见文档。
  • QN.on QN.off QN.emit 接口升级,调用更简单。新增多个系统级事件。
  • QN.sso 升级,支持 forceReAuth
  • QN.navigator 升级,支持页面降级时自动转换URL,新增 N 多系统图标。

如果你仍在使用 QAP-SDK 1.x,请参考:QAP-SDK 1.x 文档

1.2. Getting start

1.2.1. 在 QAP 环境中使用

接入千牛QAP应用平台请参考详细文档

安装 Install

npm install QAP-SDK --save

QN SDK 依赖于 Promise,对于不支持的环境,还需要安装 Promise polyfill

npm install es6-promise-polyfill --save;

调用 SDK 接口

import QN from 'QAP-SDK';

// Promise 形式
QN.top.invoke({
    query: {
        method: 'taobao.time.get', // TOP 接口名称
    },
}).then(result => {
    console.log(result);
}, error => {
    console.log(error);
});

// 回调函数形式
QN.top.invoke({
    query: {
        method: 'taobao.time.get', // TOP 接口名称
    },
    success(result) {
        console.log(result);
    },
    error(error) {
        console.log(error);
    }
});

1.2.2. 在 H5 环境中使用

引入 QAP-SDK

Product Version:

<script src="//g.alicdn.com/x-bridge/qap-sdk/2.4.0/qn.min.js"></script>

Development Version:

<script src="//g.alicdn.com/x-bridge/qap-sdk/2.4.0/qn.js"></script>

调用 SDK 接口

QN.top.invoke({
    query: {
        method: 'taobao.time.get', // TOP 接口名称
    },
}).then(result => {
    console.log(result);
}, error => {
    console.log(error);
});

results matching ""

    No results matching ""