优健康生活jssdk文档

优健康生活 jssdk

安装及使用

npm安装

首先,你需要使用 npm 或者 yarn 安装 ulife-jssdk

# 使用 npm 安装
$ npm install ulife-jssdk

# OR 使用 yarn 安装
$ yarn add ulife-jssdk

# OR 安装了 cnpm,使用 cnpm 安装
$ cnpm install ulife-jssdk
// 安装npm包并导入插件
import ulifeJSSDK from 'ulife-jssdk';
const config = { 
    debug: false // 是否开启debug模式,默认不开启
}

let ulife = new ulifeJSSDK(config);

浏览器加载

// 浏览器加载执行js
<script src="https://app.h5.ihaozhuo.com/ulife/ulife-jssdk.js"></script>
<script>
    const config = { 
        debug: false // 是否开启debug模式,默认不开启
    }

    let ulife = new ulifeJSSDK(config)
</script>

代码示例

// type 1: umd.js mode (ulife in window)
ulife.fetchReportDetail({
    healthArchiveId: '1111',
    success: (res) => {
        this.toast('成功回调', res);
    },
    fail: (res) => this.toast(res)
});

// type 2: es mode (ulife in vue.prototype)
this.ulife.fetchReportDetail({
    healthArchiveId: '1111',
    success: (res) => {
        this.toast('成功回调', res);
    },
    fail: (res) => this.toast(res)
});

目录

文档主要分为下面几个方面:

第一章:小程序

平台小程序相关功能

第二章:基础开发接口

基础接口文档

第三章:多媒体

图片,音频,视频功能

第四章:文件

处理相关文件

第五章:数据缓存

app缓存

第六章:设备

获取设备相关权限
上次更新: 11/21/2019, 4:45:47 PM