0.0.1-alpha.28 • Published 3 years ago
@keystore/lib v0.0.1-alpha.28
keystore lib
工具库
Usage
npm i @keystore/lib
生成npm可引用文件
npm run pub:export
fetch
import {get, put, post, remove, getJson, putJson, postJson, removeJson} from '@keystore/lib/fetch';
get({path, data});
put({path, data, contentType, defaultQuery});
post({path, data, contentType});
remove({path, data, contentType});
- getJson, putJson, postJson, removeJson对应get,put,post,remove的返回值转成JSON对象
按需加载(code splitting)
import Loadable from '@keystore/lib/loadable';
export default (props) => Loadable({
view: () => import(/* webpackChunkName: "test" */'./views'),
reducer: () => import(/* webpackChunkName: "testReducer" */'./reducer'),
sagas: () => import(/* webpackChunkName: "testSagas" */'./sagas')
},props)
- reducer和sagas为可选项,非必传
//reducer.js
import * as types from './actionType';
import reducerName from './reducerName'
const initState = {};
const reducer = (state = initState,action) => {
const {type} = action;
switch (type) {
case types.INIT: {
return {type}
}
default: {
return state;
}
}
};
export default {
[reducerName]: reducer
}
Provider
import React from 'react';
import {render} from 'dom';
import Root from './root';
import Provider from '@keystore/lib/provider';
render(<Provider root={Root}/>, document.getElementById('app'));
0.0.1-alpha.28
3 years ago
0.0.1-alpha.27
4 years ago
0.0.1-alpha.24
4 years ago
0.0.1-alpha.23
4 years ago
0.0.1-alpha.22
4 years ago
0.0.1-alpha.21
4 years ago
0.0.1-alpha.20
4 years ago
0.0.1-alpha.19
4 years ago
0.0.1-alpha.18
4 years ago
0.0.1-alpha.17
4 years ago
0.0.1-alpha.16
4 years ago
0.0.1-alpha.15
4 years ago
0.0.1-alpha.14
4 years ago
0.0.1-alpha.12
4 years ago
0.0.1-alpha.13
4 years ago
0.0.1-alpha.11
4 years ago
0.0.1-alpha.10
4 years ago
0.0.1-alpha.9
4 years ago
0.0.1-alpha.8
4 years ago
0.0.1-alpha.7
4 years ago
0.0.1-alpha.6
4 years ago
0.0.1-alpha.5
4 years ago
0.0.1-alpha.3
5 years ago
0.0.1-alpha.2
5 years ago
0.0.1-alpha.1
5 years ago