How to use dva-loading - 10 common examples

To help you get started, we’ve selected a few dva-loading examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github chanshiyucx / heart-beat / src / index.js View on Github external
import router from './router'
import config from './config'

// Leancloud
AV.init(config.leancloud)

// 1. Initialize
const app = dva({
  history: hashHistory,
  onError(e) {
    console.log('出错啦!', e)
  },
})

// 2. Plugins
app.use(createLoading())

// 3. Model
registerModels(app)

// 4. Router
app.router(router)

// 5. Start
app.start('#root')
github ChaoYuLeo / electron-dva-boilerplate / app / index.js View on Github external
import React from 'react';
import dva from 'dva';
import createLoading from 'dva-loading';
import { render } from 'react-dom';
import router from './renderer/router'
import appModel from './renderer/models/app'
import './renderer/app.global.css';

const app = dva({
  onError: function(err) {
    console.log(err)
  }
});

// 2. Plugins
app.use(createLoading());

// 3. Register global model
// app.model(require('./models/global').default);
app.model(appModel)

// 4. Router
app.router(router);

// 5. Start
app.start('#root');


if (module.hot) {
  module.hot.accept('./renderer/routes/App', () => {
    app.router(require('./renderer/router')); // eslint-disable-line global-require
    app.start('#root');
github dvajs / dva-example-user-dashboard / src / index.js View on Github external
import { message } from 'antd';
import './index.html';
import './index.css';

const ERROR_MSG_DURATION = 3; // 3 秒

// 1. Initialize
const app = dva({
  history: browserHistory,
  onError(e) {
    message.error(e.message, ERROR_MSG_DURATION);
  },
});

// 2. Plugins
app.use(createLoading());

// 3. Model
// Moved to router.js

// 4. Router
app.router(require('./router'));

// 5. Start
app.start('#root');
github hugetiny / quit-smoking / src / utils / dva.js View on Github external
function createApp (opt) {
  // redux日志
  // opt.onAction = [createLogger()];
  app = create(opt)
  app.use(createLoading({}))

  // 适配支付宝小程序
  if (Taro.getEnv() === Taro.ENV_TYPE.ALIPAY) {
    global = {}
  }

  if (!global.registered) opt.models.forEach(model => app.model(model))
  global.registered = true
  app.start()

  store = app._store
  app.getStore = () => store

  dispatch = store.dispatch

  app.dispatch = dispatch
github LANIF-UI / dva-boot-desktop / src / index.js View on Github external
import React from 'react';
import dva from 'dva';
import { Router } from 'dva/router';
import dynamic from 'dva/dynamic';
import createLoading from 'dva-loading';
import createHistory from 'history/createHashHistory';
import request from 'cmn-utils/lib/request';
import createRoutes from '@/routes';
import 'assets/styles/index.less';
import config from './config';

// -> 初始化
const app = dva({ history: createHistory() });

// -> 插件
app.use(createLoading());
app.use({onError: config.exception.global});
request.config(config.request);
// -> 使用mock数据
require('./__mocks__');
dynamic.setDefaultLoadingComponent(() => config.router.loading);

// -> 注册全局模型
app.model(require('./models/global').default);

// -> 初始化路由
app.router(({ history, app }) => (
  {createRoutes(app)})
);

// -> Start
app.start('#root');
github canisminor1990 / sketch-select / panel / index.js View on Github external
import createLoading from 'dva-loading';
import './index.scss';

// 1. Initialize
const app = dva({
  onError(e) {
    message.error(e.message, 3);
  },
});

// 2. Models
app.model(require('./models/config').default);
app.model(require('./models/layers').default);

// 2. Plugins
app.use(createLoading());

// 3. Router
app.router(require('./router').default);

// 4. Start
app.start('#root');

// 5. Sketch
window.getSelection = json => localStorage.setItem('selection', JSON.stringify(json));

// Disable the context menu to have a more native feel
document.addEventListener('contextmenu', e => e.preventDefault());
github ccxcxd / GFDB-Web / src / entries / index.zh.js View on Github external
// 全局变量注入
window.__ = __
window.mDB = mDB
window.qDB = qDB

const basePath = PUBLIC_PATH
// import '../index.less'
// 1. Initialize
const app = dva({
  history: createHistory({
    basename: `${basePath}${LANG.name}`,
  }),
})

// 2. Plugins
app.use(createLoading())

// 3. Register global model
app.model(require('../models/app').default(LANG))
app.model(require('../models/maps').default)
app.model(require('../models/quest').default)

// 4. Router
app.router(require('../router').default(LANG))

// 5. Start
app.start('#root')

// export default app // eslint-disable-line
github ant-design / ant-design-pro-layout / src / index.js View on Github external
import createHistory from 'history/createHashHistory';
// user BrowserHistory
// import createHistory from 'history/createBrowserHistory';
import createLoading from 'dva-loading';
import 'moment/locale/zh-cn';
import './rollbar';

import './index.less';
// 1. Initialize
const app = dva({
  history: createHistory(),
});

// 2. Plugins
app.use(createLoading());

// 3. Register global model
app.model(require('./models/global').default);

// 4. Router
app.router(require('./router').default);

// 5. Start
app.start('#root');

export default app._store; // eslint-disable-line
github dvajs / dva / packages / dva-example-user-dashboard / src / index.js View on Github external
import createLoading from 'dva-loading';
import { message } from 'antd';
import './index.css';

const ERROR_MSG_DURATION = 3; // 3 秒

// 1. Initialize
const app = dva({
  history: createHistory(),
  onError(e) {
    message.error(e.message, ERROR_MSG_DURATION);
  },
});

// 2. Plugins
app.use(createLoading());

// 3. Model
// Moved to router.js

// 4. Router
app.router(require('./router'));

// 5. Start
app.start('#root');
github lanzhsh / react-vue-koa / dva-umi-template / pages / .umi / initDva.js View on Github external
import dva from 'dva';
import createLoading from 'dva-loading';

const runtimeDva = window.g_plugins.mergeConfig('dva');
let app = dva({
  history: window.g_history,
  
  ...(runtimeDva.config || {}),
});

window.g_app = app;
app.use(createLoading());
(runtimeDva.plugins || []).forEach(plugin => {
  app.use(plugin);
});

app.model({ namespace: 'analysis', ...(require('E:/my-react/react-pc-template/pages/dashboard/models/analysis.js').default) });
app.model({ namespace: 'login', ...(require('E:/my-react/react-pc-template/pages/login/models/login.js').default) });

dva-loading

Auto loading data binding plugin for dva.

MIT
Latest version published 8 months ago

Package Health Score

66 / 100
Full package analysis

Popular dva-loading functions