dva-loading
监听异步加载状态
装置 dva-loading
npm install dva-loading --save
用法
import createLoading from 'dva-loading';
const app = dva();
app.use(createLoading(opts));
参数 opts
opts.namespace
返回状态
loading: {
global: false,
models: {
users: false,
todos: false,
...
},
effects: {}}
dva-loading Git 地址
示例
// index.js
import './index.html';
import './index.less';
import dva, {connect} from 'dva';
import createLoading from 'dva-loading';
// 1. Initialize
const app \= dva(createLoading());
// 2. Model
app.model(require('./models/item'));
app.model(require('./models/user'));
// 3. Router
app.router(require('./router'));
// 4. Start
app.start('#root');