How to use dva - 10 common examples

To help you get started, we’ve selected a few dva 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 kuhami / react-ant / src / pages / List / Articles.js View on Github external
import React, { Component, Fragment } from 'react';
import { connect } from 'dva';
import { Form, Card, Select, List, Tag, Icon, Row, Col, Button } from 'antd';

import TagSelect from '@/components/TagSelect';
import StandardFormRow from '@/components/StandardFormRow';
import ArticleListContent from '@/components/ArticleListContent';
import styles from './Articles.less';

const { Option } = Select;
const FormItem = Form.Item;

const pageSize = 5;

@connect(({ list, loading }) => ({
  list,
  loading: loading.models.list,
}))
@Form.create({
  onValuesChange({ dispatch }, changedValues, allValues) {
    // 表单项变化时请求数据
    // eslint-disable-next-line
    console.log(changedValues, allValues);
    // 模拟查询表单生效
    dispatch({
      type: 'list/fetch',
      payload: {
        count: 5,
      },
    });
  },
github goodrain / rainbond-ui / src / routes / App / connectionInformation.js View on Github external
import SetMemberAppAction from "../../components/SetMemberAppAction";
import ScrollerX from "../../components/ScrollerX";
import AddVarModal from "./setting/env";
import ConfirmModal from "../../components/ConfirmModal";
import globalUtil from "../../utils/global";


const FormItem = Form.Item;
import {
  getStatus,
  restart
} from '../../services/app';
import { width } from "window-size";
const RadioGroup = Radio.Group;

@connect(
  ({ user, appControl, teamControl }) => ({
    currUser: user.currentUser,
    innerEnvs: appControl.innerEnvs,
    startProbe: appControl.startProbe,
    runningProbe: appControl.runningProbe,
    ports: appControl.ports,
    baseInfo: appControl.baseInfo,
    // tags: appControl.tags,
    appDetail: appControl.appDetail,
    outerEnvs: appControl.outerEnvs,
    teamControl,
    appControl,
  }),
  null,
  null,
  { withRef: true },
github goodrain / rainbond-ui / src / routes / Create / create-moreService.js View on Github external
import React, { PureComponent, Fragment } from 'react';
import {
  Button, notification, Tooltip, Radio
} from 'antd';
import { connect } from 'dva';
import { routerRedux } from 'dva/router';
import globalUtil from '../../utils/global';
import { Link } from 'dva/router';
import httpResponseUtil from '../../utils/httpResponse';
import ConfirmModal from '../../components/ConfirmModal';

import appUtil from '../../utils/app';
import { buildApp } from '../../services/createApp';
import AppCreateMoreService from '../../components/AppCreateMoreService';

@connect(({ user, appControl, teamControl, createApp }) => ({}), null, null, { withRef: true })
export default class Index extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {
      //property、deploy
      type: 'property',
      appDetail: null,
      data: null,
      JavaMavenData: [],
      is_deploy: true,
      buildState: false
    }
  }
  componentDidMount() {
    // this.loadDetail();
    this.getMultipleModulesInfo();
github goodrain / rainbond-ui / src / layouts / InitTeamAndRegionData.js View on Github external
import React from 'react';
import { connect } from 'dva';
import globalUtil from '../utils/global';

@connect()
export default class Index extends React.PureComponent {
  componentWillMount() {
    const currTeam = globalUtil.getCurrTeamName();
    const currRegion = globalUtil.getCurrRegionName();
    // 获取群组
    this.props.dispatch({
      type: 'global/fetchGroups',
      payload: {
        team_name: currTeam,
        region_name: currRegion,
      },
    });

    this.props.dispatch({
      type: 'global/saveCurrTeamAndRegion',
      payload: {
github kuhami / react-ant-pro / src / routes / User / Login.js View on Github external
import React, { Component } from 'react';
import { connect } from 'dva';
import { Link } from 'dva/router';
import { Checkbox, Alert, Icon } from 'antd';
import Login from 'components/Login';
import styles from './Login.less';

const { Tab, UserName, Password, Mobile, Captcha, Submit } = Login;

@connect(({ login, loading }) => ({
  login,
  submitting: loading.effects['login/login'],
}))
export default class LoginPage extends Component {
  state = {
    type: 'account',
    autoLogin: true,
  };
  onTabChange = type => {
    this.setState({ type });
  };

  handleSubmit = (err, values) => {
    const { type } = this.state;
    console.log({
        type: 'login/login',
github goodrain / rainbond-ui / src / components / ImageCmdForm / index.js View on Github external
import AddGroup from '../../components/AddOrEditGroup';
import globalUtil from '../../utils/global';
const { Option } = Select;
const { TextArea } = Input;


const formItemLayout = {
	labelCol: {
		span: 5,
	},
	wrapperCol: {
		span: 19,
	},
};

@connect(({ user, global, loading }) => ({
	groups: global.groups,
	createAppByDockerrunLoading: loading.effects['createApp/createAppByDockerrun']
}), null, null, { withRef: true })

@Form.create()
export default class Index extends PureComponent {
	constructor(props) {
		super(props);
		this.state = {
			codeType: 'Git',
			showUsernameAndPass: false,
			showKey: false,
			addGroup: false,
		}
	}
	onAddGroup = () => {
github goodrain / rainbond-ui / src / components / AppCreateMoreService / index.js View on Github external
)}
        
    );
  }
}

@connect(
  ({ user, appControl }) => ({ currUser: user.currentUser }),
  null,
  null,
  { withRef: true }
)
export default class Index extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {};
  }
  render() {
    const data = this.props.data;
    return (
      <div>
        </div><table style="{{">
      </table>
github goodrain / rainbond-ui / src / components / CodeBuildConfig / nodejs / index.js View on Github external
import React, { PureComponent } from "react";
import { Form, Radio, Switch, Input } from "antd";
import { connect } from "dva";
const RadioGroup = Radio.Group;

@connect(null, null, null, { withRef: true })
class Index extends PureComponent {
  constructor(props) {
    super(props);
    this.state = {
        webType: "",
        nodeType: "",
        nodeBuildType: "",
    }
  }

  onRadioNodeBuildTypeChange = e => {
    this.setState({
      nodeBuildType: e.target.value
    });
  };
github hyperledger / cello / src / dashboard / src / pages / Operator / Overview.js View on Github external
import React, { PureComponent } from 'react';
import { connect } from 'dva';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';

@connect(() =&gt; ({}))
class Overview extends PureComponent {
  render() {
    return Overview;
  }
}

export default Overview;
github mojisrc / fashop-admin / src / components / goods / add / editor / empty.js View on Github external
import React,{ Component } from "react";
import { connect } from "dva";
import { View } from "@/components/flexView";
import styles from './empty.css'
@connect()
export default class Empty extends Component {
    render() {
        return (
            
        )
    }
}

dva

React and redux based, lightweight and elm-style framework.

MIT
Latest version published 6 years ago

Package Health Score

50 / 100
Full package analysis

Popular dva functions