0.1.3 • Published 10 months ago
@kjts20/tool-react-h5 v0.1.3
时时工具包-react 语言的 h5 专用
安装方式
npm install @kjts20/tool-react-h5
直接引入就即可使用
使用方面
import { axios2HttpServer, localStorageImpl, sessionStorageImpl } from '@kjts20/tool-react-h5';
import { CommonStorage, HttpServer, ResponseFilter } from '@kjts20/tool';
const httpServer = new HttpServer({
...axios2HttpServer,
host,
apiPrefix: mapiPrefix,
setHeader() {
return {
token: getToken()
};
},
responseIntercept(response) {
if (response.code === 308) {
MessagePlugin.warning('登录过期,请先登录!');
loginOut();
throw new Error('未登录!');
} else {
return response;
}
}
});
export const storage = new CommonStorage(sessionStorageImpl);
export const storageLocaltion = new CommonStorage(localStorageImpl);
// 平台兼容
import { platformPolyfill } from '@kjts20/tool';
platformPolyfill();
import { downloadJson, downloadCsv} from '@kjts20/tool-react-h5';
// 下载json文件
const jsonData = [
{ title: 'ID,', column: 'id' },
{ title: "标题'", column: 'title' },
{ title: '描述"', column: 'description' }
];
downloadJson('test.json',jsonData);
// 下载csv
const csvHeaderList = [
{ title: 'ID,', column: 'id' },
{ title: "标题'", column: 'title' },
{ title: '描述"', column: 'description' }
];
const csvBody = [
{id: 1, title: '测试11,等待的', description: '双引号"测试' }
{id: 2, title: '测试222,等待的', description: '双引号"测试' }
];
downloadCsv('test.csv',csvHeaderList, csvBody);
0.0.30
11 months ago
0.1.0
11 months ago
0.1.2
10 months ago
0.1.1
11 months ago
0.1.3
10 months ago
0.0.20
1 year ago
0.0.21
1 year ago
0.0.22
1 year ago
0.0.23
1 year ago
0.0.24
1 year ago
0.0.25
1 year ago
0.0.15
1 year ago
0.0.16
1 year ago
0.0.17
1 year ago
0.0.18
1 year ago
0.0.19
1 year ago
0.0.27
1 year ago
0.0.28
1 year ago
0.0.29
1 year ago
0.0.13
1 year ago
0.0.14
1 year ago
0.0.12
1 year ago
0.0.11
1 year ago
0.0.10
1 year ago
0.0.9
1 year ago
0.0.8
1 year ago
0.0.7
1 year ago
0.0.6
1 year ago
0.0.5
1 year ago
0.0.4
1 year ago
0.0.3
1 year ago
0.0.2
1 year ago
0.0.1
1 year ago