one-utils

Super useful utility tool library

兼容web,小程序

Install using npm

one-utils

npm install one-utils --save
yarn add one-utils --save

Api

1. initial

初始化oneUtils运行环境,创建实例

const oneIns = oneUtils.create({ engine: wx || window });

2. dom

根据运行环境不同,选择dom或者wxml

3. fetch

和web fetch用法相同

oneIns.fetch({
  url: 'http://github.com',
  method: 'GET/POST',
  header: {}, // custom request header,
  body: {}, // submit data
}).then(res => console.log(res));