Files
ant-design/docs/react/practical-projects.html
T
2016-12-23 12:01:39 +08:00

187 lines
57 KiB
HTML

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="An enterprise-class UI design language and React-based implementation">
<meta name="description" content="A set of high-quality React components">
<meta name="description" content="One of best React UI library for enterprise background">
<title>Ant Design - One Design Language</title>
<link rel="icon" href="https://t.alipayobjects.com/images/T1QUBfXo4fXXXXXXXX.png" type="image/x-icon">
<link rel="stylesheet" type="text/css" href="https://fonts.googleapis.cnpmjs.org/css?family=Lato:400,700|Raleway"/>
<link rel="stylesheet" type="text/css" href="/index-1.css"/>
<link rel="stylesheet" type="text/css" href="/index-2.css"/>
<style id="nprogress-style">
#nprogress { display: none }
</style>
<!--[if lte IE 10]>
<script
src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,media-match/2.0.2/media.match.min.js"></script>
<![endif]-->
<script>
if (!window.Intl) {
document.writeln('<script src="https://as.alipayobjects.com/g/component/intl/1.0.1/??Intl.js,locale-data/jsonp/en.js,locale-data/jsonp/zh.js">' + '<' + '/script>');
}
if (!window.Promise) {
document.writeln('<script src="https://as.alipayobjects.com/g/component/es6-promise/3.2.2/es6-promise.min.js"' + '>' + '<' + '/' + 'script>');
}
</script>
</head>
<body>
<div id="react-content">
<div class="page-wrapper" data-reactroot="" data-reactid="1" data-react-checksum="511772334"><header id="header" class="clearfix" data-reactid="2"><div class="ant-row" data-reactid="3"><div class="ant-col-xs-24 ant-col-sm-24 ant-col-md-6 ant-col-lg-4" data-reactid="4"><a id="logo" href="/" data-reactid="5"><img alt="logo" src="https://t.alipayobjects.com/images/rmsweb/T1B9hfXcdvXXXXXXXX.svg" data-reactid="6"/><span data-reactid="7">Ant Design</span></a></div><div style="display:block;" class="ant-col-xs-0 ant-col-sm-17 ant-col-md-18 ant-col-lg-20" data-reactid="8"><div id="search-box" data-reactid="9"><div class="ant-select ant-select-combobox ant-select-enabled" data-reactid="10"><div class="ant-select-selection
ant-select-selection--single" role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" data-reactid="11"><div class="ant-select-selection__rendered" data-reactid="12"><div style="display:block;user-select:none;-webkit-user-select:none;" unselectable="unselectable" class="ant-select-selection__placeholder" data-reactid="13">Search Components...</div><ul data-reactid="14"><li class="ant-select-search ant-select-search--inline" data-reactid="15"><div class="ant-select-search__field__wrap" data-reactid="16"><input value="" class="ant-select-search__field" data-reactid="17"/><span class="ant-select-search__field__mirror" data-reactid="18"></span></div></li></ul></div><span class="ant-select-arrow" style="user-select:none;-webkit-user-select:none;" unselectable="unselectable" data-reactid="19"><b data-reactid="20"></b></span></div></div></div><button type="button" class="ant-btn ant-btn-ghost ant-btn-sm lang" data-reactid="21"><span data-reactid="22"><!-- react-text: 23 -->中文<!-- /react-text --></span></button><ul class="ant-menu ant-menu-horizontal ant-menu-light ant-menu-root" role="menu" aria-activedescendant="" id="nav" tabindex="0" data-reactid="24"><li class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="25"><a href="/" data-reactid="26"><span data-reactid="27"><!-- react-text: 28 -->Home<!-- /react-text --></span></a></li><li class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="29"><a href="/docs/spec/introduce" data-reactid="30"><span data-reactid="31"><!-- react-text: 32 -->Specification<!-- /react-text --></span></a></li><li class="ant-menu-item-selected ant-menu-item" role="menuitem" aria-selected="true" data-reactid="33"><a href="/docs/react/introduce" data-reactid="34"><span data-reactid="35"><!-- react-text: 36 -->Components<!-- /react-text --></span></a></li><li class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="37"><a href="/docs/pattern/navigation" data-reactid="38"><span data-reactid="39"><!-- react-text: 40 -->Pattern<!-- /react-text --></span></a></li><li class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="41"><a href="/docs/practice/cases" data-reactid="42"><span data-reactid="43"><!-- react-text: 44 -->Practice<!-- /react-text --></span></a></li><li class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="45"><a href="/docs/resource/download" data-reactid="46"><span data-reactid="47"><!-- react-text: 48 -->Resource<!-- /react-text --></span></a></li></ul></div></div></header><div class="main-wrapper" data-reactid="49"><div class="ant-row" data-reactid="50"><div class="ant-col-xs-24 ant-col-sm-24 ant-col-md-6 ant-col-lg-4" data-reactid="51"><ul class="ant-menu ant-menu-inline aside-container ant-menu-light ant-menu-root" role="menu" aria-activedescendant="" tabindex="0" data-reactid="52"><li style="padding-left:24px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="53"><a href="/docs/react/introduce" data-reactid="54">Ant Design of React</a></li><li style="padding-left:24px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="55"><a href="/docs/react/getting-started" data-reactid="56">Getting Started</a></li><li style="padding-left:24px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="57"><a href="/docs/react/install" data-reactid="58">Installation</a></li><li style="padding-left:24px;" class="ant-menu-item-selected ant-menu-item" role="menuitem" aria-selected="true" data-reactid="59"><a href="/docs/react/practical-projects" data-reactid="60">Real world Example with dva</a></li><li style="padding-left:24px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="61"><a href="/docs/react/use-with-create-react-app" data-reactid="62">Use with create-react-app</a></li><li style="padding-left:24px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="63"><a href="/docs/react/customize-theme" data-reactid="64">Customize Theme</a></li><li style="padding-left:24px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="65"><a href="//github.com/ant-design/intl-example" target="_blank" rel="noopener noreferrer" data-reactid="66">i18n Solution</a></li><li style="padding-left:24px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="67"><a href="/changelog" data-reactid="68">Change Log</a></li><li class="ant-menu-submenu-inline ant-menu-submenu-open ant-menu-submenu" data-reactid="69"><div style="padding-left:24px;" class="ant-menu-submenu-title" aria-open="true" aria-owns="1482465667110_10" aria-haspopup="true" data-reactid="70"><h4 data-reactid="71">Components</h4></div><ul class="ant-menu ant-menu-inline ant-menu-sub" role="menu" aria-activedescendant="" id="1482465667110_10" data-reactid="72"><li class=" ant-menu-item-group" data-reactid="73"><div class="ant-menu-item-group-title" data-reactid="74">General</div><ul class="ant-menu-item-group-list" data-reactid="75"><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="76"><a href="/components/button/" data-reactid="77"><span data-reactid="78">Button</span><span class="chinese" data-reactid="79"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="80"><a href="/components/icon/" data-reactid="81"><span data-reactid="82">Icon</span><span class="chinese" data-reactid="83"></span></a></li></ul></li><li class=" ant-menu-item-group" data-reactid="84"><div class="ant-menu-item-group-title" data-reactid="85">Layout</div><ul class="ant-menu-item-group-list" data-reactid="86"><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="87"><a href="/components/grid/" data-reactid="88"><span data-reactid="89">Grid</span><span class="chinese" data-reactid="90"></span></a></li></ul></li><li class=" ant-menu-item-group" data-reactid="91"><div class="ant-menu-item-group-title" data-reactid="92">Navigation</div><ul class="ant-menu-item-group-list" data-reactid="93"><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="94"><a href="/components/affix/" data-reactid="95"><span data-reactid="96">Affix</span><span class="chinese" data-reactid="97"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="98"><a href="/components/anchor/" data-reactid="99"><span data-reactid="100">Anchor</span><span class="chinese" data-reactid="101"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="102"><a href="/components/back-top/" data-reactid="103"><span data-reactid="104">BackTop</span><span class="chinese" data-reactid="105"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="106"><a href="/components/breadcrumb/" data-reactid="107"><span data-reactid="108">Breadcrumb</span><span class="chinese" data-reactid="109"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="110"><a href="/components/dropdown/" data-reactid="111"><span data-reactid="112">Dropdown</span><span class="chinese" data-reactid="113"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="114"><a href="/components/menu/" data-reactid="115"><span data-reactid="116">Menu</span><span class="chinese" data-reactid="117"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="118"><a href="/components/pagination/" data-reactid="119"><span data-reactid="120">Pagination</span><span class="chinese" data-reactid="121"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="122"><a href="/components/steps/" data-reactid="123"><span data-reactid="124">Steps</span><span class="chinese" data-reactid="125"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="126"><a href="/components/tabs/" data-reactid="127"><span data-reactid="128">Tabs</span><span class="chinese" data-reactid="129"></span></a></li></ul></li><li class=" ant-menu-item-group" data-reactid="130"><div class="ant-menu-item-group-title" data-reactid="131">Data Entry</div><ul class="ant-menu-item-group-list" data-reactid="132"><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="133"><a href="/components/auto-complete/" data-reactid="134"><span data-reactid="135">AutoComplete</span><span class="chinese" data-reactid="136"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="137"><a href="/components/checkbox/" data-reactid="138"><span data-reactid="139">Checkbox</span><span class="chinese" data-reactid="140"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="141"><a href="/components/cascader/" data-reactid="142"><span data-reactid="143">Cascader</span><span class="chinese" data-reactid="144"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="145"><a href="/components/date-picker/" data-reactid="146"><span data-reactid="147">DatePicker</span><span class="chinese" data-reactid="148"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="149"><a href="/components/form/" data-reactid="150"><span data-reactid="151">Form</span><span class="chinese" data-reactid="152"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="153"><a href="/components/input/" data-reactid="154"><span data-reactid="155">Input</span><span class="chinese" data-reactid="156"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="157"><a href="/components/input-number/" data-reactid="158"><span data-reactid="159">InputNumber</span><span class="chinese" data-reactid="160"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="161"><a href="/components/mention/" data-reactid="162"><span data-reactid="163">Mention</span><span class="chinese" data-reactid="164"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="165"><a href="/components/radio/" data-reactid="166"><span data-reactid="167">Radio</span><span class="chinese" data-reactid="168"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="169"><a href="/components/rate/" data-reactid="170"><span data-reactid="171">Rate</span><span class="chinese" data-reactid="172"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="173"><a href="/components/select/" data-reactid="174"><span data-reactid="175">Select</span><span class="chinese" data-reactid="176"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="177"><a href="/components/slider/" data-reactid="178"><span data-reactid="179">Slider</span><span class="chinese" data-reactid="180"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="181"><a href="/components/switch/" data-reactid="182"><span data-reactid="183">Switch</span><span class="chinese" data-reactid="184"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="185"><a href="/components/time-picker/" data-reactid="186"><span data-reactid="187">TimePicker</span><span class="chinese" data-reactid="188"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="189"><a href="/components/transfer/" data-reactid="190"><span data-reactid="191">Transfer</span><span class="chinese" data-reactid="192"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="193"><a href="/components/tree-select/" data-reactid="194"><span data-reactid="195">TreeSelect</span><span class="chinese" data-reactid="196"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="197"><a href="/components/upload/" data-reactid="198"><span data-reactid="199">Upload</span><span class="chinese" data-reactid="200"></span></a></li></ul></li><li class=" ant-menu-item-group" data-reactid="201"><div class="ant-menu-item-group-title" data-reactid="202">Data Display</div><ul class="ant-menu-item-group-list" data-reactid="203"><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="204"><a href="/components/badge/" data-reactid="205"><span data-reactid="206">Badge</span><span class="chinese" data-reactid="207"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="208"><a href="/components/card/" data-reactid="209"><span data-reactid="210">Card</span><span class="chinese" data-reactid="211"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="212"><a href="/components/carousel/" data-reactid="213"><span data-reactid="214">Carousel</span><span class="chinese" data-reactid="215"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="216"><a href="/components/collapse/" data-reactid="217"><span data-reactid="218">Collapse</span><span class="chinese" data-reactid="219"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="220"><a href="/components/calendar/" data-reactid="221"><span data-reactid="222">Calendar</span><span class="chinese" data-reactid="223"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="224"><a href="/components/popover/" data-reactid="225"><span data-reactid="226">Popover</span><span class="chinese" data-reactid="227"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="228"><a href="/components/table/" data-reactid="229"><span data-reactid="230">Table</span><span class="chinese" data-reactid="231"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="232"><a href="/components/tag/" data-reactid="233"><span data-reactid="234">Tag</span><span class="chinese" data-reactid="235"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="236"><a href="/components/timeline/" data-reactid="237"><span data-reactid="238">Timeline</span><span class="chinese" data-reactid="239"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="240"><a href="/components/tooltip/" data-reactid="241"><span data-reactid="242">Tooltip</span><span class="chinese" data-reactid="243"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="244"><a href="/components/tree/" data-reactid="245"><span data-reactid="246">Tree</span><span class="chinese" data-reactid="247"></span></a></li></ul></li><li class=" ant-menu-item-group" data-reactid="248"><div class="ant-menu-item-group-title" data-reactid="249">Feedback</div><ul class="ant-menu-item-group-list" data-reactid="250"><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="251"><a href="/components/alert/" data-reactid="252"><span data-reactid="253">Alert</span><span class="chinese" data-reactid="254"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="255"><a href="/components/message/" data-reactid="256"><span data-reactid="257">Message</span><span class="chinese" data-reactid="258"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="259"><a href="/components/modal/" data-reactid="260"><span data-reactid="261">Modal</span><span class="chinese" data-reactid="262"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="263"><a href="/components/notification/" data-reactid="264"><span data-reactid="265">Notification</span><span class="chinese" data-reactid="266"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="267"><a href="/components/popconfirm/" data-reactid="268"><span data-reactid="269">Popconfirm</span><span class="chinese" data-reactid="270"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="271"><a href="/components/progress/" data-reactid="272"><span data-reactid="273">Progress</span><span class="chinese" data-reactid="274"></span></a></li><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="275"><a href="/components/spin/" data-reactid="276"><span data-reactid="277">Spin</span><span class="chinese" data-reactid="278"></span></a></li></ul></li><li class=" ant-menu-item-group" data-reactid="279"><div class="ant-menu-item-group-title" data-reactid="280">Other</div><ul class="ant-menu-item-group-list" data-reactid="281"><li style="padding-left:48px;" class="ant-menu-item" role="menuitem" aria-selected="false" data-reactid="282"><a href="/components/locale-provider/" data-reactid="283"><span data-reactid="284">LocaleProvider</span><span class="chinese" data-reactid="285"></span></a></li></ul></li></ul></li></ul></div><div class="main-container ant-col-xs-24 ant-col-sm-24 ant-col-md-18 ant-col-lg-20" data-reactid="286"><article class="markdown" data-reactid="287"><h1 data-reactid="288"><!-- react-text: 289 -->Real world Example with dva<!-- /react-text --><a class="edit-button" href="https://github.com/ant-design/ant-design/blob/master/docs/react/practical-projects.en-US.md" data-reactid="290"><i class="anticon anticon-edit" data-reactid="291"></i></a></h1><section class="markdown" data-reactid="292"><p data-reactid="293"><a href="https://github.com/dvajs/dva" data-reactid="294"><!-- react-text: 295 -->dva<!-- /react-text --></a><!-- react-text: 296 --> is a React and redux based, lightweight and elm-style framework, which supports side effects, hot module replacement, dynamic on demand, react-native, SSR. And it has been widely used in production environment.<!-- /react-text --></p><p data-reactid="297"><!-- react-text: 298 -->This article will guide you to create a simple application from zero using dva and antd.<!-- /react-text --></p><p data-reactid="299"><!-- react-text: 300 -->Include the following:<!-- /react-text --></p></section><section class="toc" data-reactid="301"><ul data-reactid="302"><li data-reactid="303"><a class="bisheng-toc-h2" href="#Install-dva-cli" data-reactid="304"><!-- react-text: 305 -->Install dva-cli<!-- /react-text --></a></li><li data-reactid="306"><a class="bisheng-toc-h2" href="#Create-New-App" data-reactid="307"><!-- react-text: 308 -->Create New App<!-- /react-text --></a></li><li data-reactid="309"><a class="bisheng-toc-h2" href="#Integrate-antd" data-reactid="310"><!-- react-text: 311 -->Integrate antd<!-- /react-text --></a></li><li data-reactid="312"><a class="bisheng-toc-h2" href="#Define-Router" data-reactid="313"><!-- react-text: 314 -->Define Router<!-- /react-text --></a></li><li data-reactid="315"><a class="bisheng-toc-h2" href="#Write-UI-Components" data-reactid="316"><!-- react-text: 317 -->Write UI Components<!-- /react-text --></a></li><li data-reactid="318"><a class="bisheng-toc-h2" href="#Define-Model" data-reactid="319"><!-- react-text: 320 -->Define Model<!-- /react-text --></a></li><li data-reactid="321"><a class="bisheng-toc-h2" href="#Connect" data-reactid="322"><!-- react-text: 323 -->Connect<!-- /react-text --></a></li><li data-reactid="324"><a class="bisheng-toc-h2" href="#Build" data-reactid="325"><!-- react-text: 326 -->Build<!-- /react-text --></a></li><li data-reactid="327"><a class="bisheng-toc-h2" href="#What&#x27;s-Next" data-reactid="328"><!-- react-text: 329 -->What&#x27;s Next<!-- /react-text --></a></li></ul></section><section class="markdown" data-reactid="330"><h2 id="Install-dva-cli" data-reactid="331"><span data-reactid="332"><!-- react-text: 333 -->Install dva-cli<!-- /react-text --></span><a href="#Install-dva-cli" class="anchor" data-reactid="334">#</a></h2><p data-reactid="335"><!-- react-text: 336 -->Install dva-cli with npm, and make sure the version is larger then <!-- /react-text --><code data-reactid="337"><!-- react-text: 338 -->0.7.0<!-- /react-text --></code><!-- react-text: 339 -->.<!-- /react-text --></p><pre class="language-bash" data-reactid="340"><code data-reactid="341">$ <span class="token function">npm</span> <span class="token function">install</span> dva-cli -g
$ dva -v
0.7.0</code></pre><h2 id="Create-New-App" data-reactid="342"><span data-reactid="343"><!-- react-text: 344 -->Create New App<!-- /react-text --></span><a href="#Create-New-App" class="anchor" data-reactid="345">#</a></h2><p data-reactid="346"><!-- react-text: 347 -->After installed dva-cli, you can have access to the <!-- /react-text --><code data-reactid="348"><!-- react-text: 349 -->dva<!-- /react-text --></code><!-- react-text: 350 --> command in terminal. Now, create a new application with <!-- /react-text --><code data-reactid="351"><!-- react-text: 352 -->dva new<!-- /react-text --></code><!-- react-text: 353 -->.<!-- /react-text --></p><pre class="language-bash" data-reactid="354"><code data-reactid="355">$ dva new dva-quickstart</code></pre><p data-reactid="356"><!-- react-text: 357 -->This creates <!-- /react-text --><code data-reactid="358"><!-- react-text: 359 -->dva-quickstart<!-- /react-text --></code><!-- react-text: 360 --> directory, that contains the project directories and files, and provides development server, build script, mock service, proxy server and so on.<!-- /react-text --></p><p data-reactid="361"><!-- react-text: 362 -->Then <!-- /react-text --><code data-reactid="363"><!-- react-text: 364 -->cd<!-- /react-text --></code><!-- react-text: 365 --> the <!-- /react-text --><code data-reactid="366"><!-- react-text: 367 -->dva-quickstart<!-- /react-text --></code><!-- react-text: 368 --> directory, and start the development server.<!-- /react-text --></p><pre class="language-bash" data-reactid="369"><code data-reactid="370">$ <span class="token function">cd</span> dva-quickstart
$ <span class="token function">npm</span> start</code></pre><p data-reactid="371"><!-- react-text: 372 -->After a few seconds, you will see the following output:<!-- /react-text --></p><pre class="language-bash" data-reactid="373"><code data-reactid="374">Compiled successfully<span class="token operator">!</span>
The app is running at:
http://localhost:8000/
Note that the development build is not optimized.
To create a production build, use <span class="token function">npm</span> run build.</code></pre><p data-reactid="375"><!-- react-text: 376 -->Open <!-- /react-text --><a href="http://localhost:8989" data-reactid="377"><!-- react-text: 378 -->http://localhost:8989<!-- /react-text --></a><!-- react-text: 379 --> in your browser, you will see dva welcome page.<!-- /react-text --></p><h2 id="Integrate-antd" data-reactid="380"><span data-reactid="381"><!-- react-text: 382 -->Integrate antd<!-- /react-text --></span><a href="#Integrate-antd" class="anchor" data-reactid="383">#</a></h2><p data-reactid="384"><!-- react-text: 385 -->Install <!-- /react-text --><code data-reactid="386"><!-- react-text: 387 -->antd<!-- /react-text --></code><!-- react-text: 388 --> and <!-- /react-text --><code data-reactid="389"><!-- react-text: 390 -->babel-plugin-import<!-- /react-text --></code><!-- react-text: 391 --> with npm. <!-- /react-text --><code data-reactid="392"><!-- react-text: 393 -->babel-plugin-import<!-- /react-text --></code><!-- react-text: 394 --> is used to automatically import scripts and stylesheets from antd in demand. See <!-- /react-text --><a href="https://github.com/ant-design/babel-plugin-import" data-reactid="395"><!-- react-text: 396 -->repo<!-- /react-text --></a><!-- react-text: 397 --><!-- /react-text --></p><pre class="language-bash" data-reactid="398"><code data-reactid="399">$ <span class="token function">npm</span> <span class="token function">install</span> antd babel-plugin-import --save</code></pre><p data-reactid="400"><!-- react-text: 401 -->Edit <!-- /react-text --><code data-reactid="402"><!-- react-text: 403 -->.roadhogrc<!-- /react-text --></code><!-- react-text: 404 --> to integrate <!-- /react-text --><code data-reactid="405"><!-- react-text: 406 -->babel-plugin-import<!-- /react-text --></code><!-- react-text: 407 -->.<!-- /react-text --></p><pre class="language-diff" data-reactid="408"><code data-reactid="409"> "extraBabelPlugins": [
<span class="token deleted">- "transform-runtime"</span>
<span class="token inserted">+ "transform-runtime",</span>
<span class="token inserted">+ ["import", { "libraryName": "antd", "style": "css" }]</span>
],</code></pre><blockquote data-reactid="410"><p data-reactid="411"><!-- react-text: 412 -->Notice: dva-cli&#x27;s build and server is bases on roadhog, view <!-- /react-text --><a href="https://github.com/sorrycc/roadhog/blob/master/README_en-us.md#configuration" data-reactid="413"><!-- react-text: 414 -->roadhog#Configuration<!-- /react-text --></a><!-- react-text: 415 --> for more <!-- /react-text --><code data-reactid="416"><!-- react-text: 417 -->.roadhogrc<!-- /react-text --></code><!-- react-text: 418 --> Configuration.<!-- /react-text --></p></blockquote><h2 id="Define-Router" data-reactid="419"><span data-reactid="420"><!-- react-text: 421 -->Define Router<!-- /react-text --></span><a href="#Define-Router" class="anchor" data-reactid="422">#</a></h2><p data-reactid="423"><!-- react-text: 424 -->We need to write an application displaying the list of products. The first step is to create a route.<!-- /react-text --></p><p data-reactid="425"><!-- react-text: 426 -->Create a route component <!-- /react-text --><code data-reactid="427"><!-- react-text: 428 -->routes/Products.js<!-- /react-text --></code><!-- react-text: 429 -->:<!-- /react-text --></p><pre class="language-javascript" data-reactid="430"><code data-reactid="431"><span class="token keyword">import</span> React <span class="token keyword">from</span> <span class="token string">'react'</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> Products <span class="token operator">=</span> <span class="token punctuation">(</span>props<span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">></span> <span class="token punctuation">(</span>
<span class="token operator">&lt;</span>h2<span class="token operator">></span>List <span class="token keyword">of</span> Products<span class="token operator">&lt;</span><span class="token operator">/</span>h2<span class="token operator">></span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword">export</span> <span class="token keyword">default</span> Products<span class="token punctuation">;</span></code></pre><p data-reactid="432"><!-- react-text: 433 -->Add routing information to router, edit <!-- /react-text --><code data-reactid="434"><!-- react-text: 435 -->router.js<!-- /react-text --></code><!-- react-text: 436 -->:<!-- /react-text --></p><pre class="language-diff" data-reactid="437"><code data-reactid="438"><span class="token inserted">+ import Products from './routes/Products';</span>
...
<span class="token inserted">+ &lt;Route path="/products" component={Products} /></span></code></pre><p data-reactid="439"><!-- react-text: 440 -->Then open <!-- /react-text --><a href="http://localhost:8989/#/products" data-reactid="441"><!-- react-text: 442 -->http://localhost:8989/#/products<!-- /react-text --></a><!-- react-text: 443 --> in your browser, you should be able to see the <!-- /react-text --><code data-reactid="444"><!-- react-text: 445 -->&lt;h2&gt;<!-- /react-text --></code><!-- react-text: 446 --> tag defined before.<!-- /react-text --></p><h2 id="Write-UI-Components" data-reactid="447"><span data-reactid="448"><!-- react-text: 449 -->Write UI Components<!-- /react-text --></span><a href="#Write-UI-Components" class="anchor" data-reactid="450">#</a></h2><p data-reactid="451"><!-- react-text: 452 -->As your application grows and you notice you are sharing UI elements between multiple pages (or using them multiple times on the same page), in dva it&#x27;s called reusable components.<!-- /react-text --></p><p data-reactid="453"><!-- react-text: 454 -->Let&#x27;s create a <!-- /react-text --><code data-reactid="455"><!-- react-text: 456 -->ProductList<!-- /react-text --></code><!-- react-text: 457 --> component that we can use in multiple places to show a list of products.<!-- /react-text --></p><p data-reactid="458"><!-- react-text: 459 -->Create <!-- /react-text --><code data-reactid="460"><!-- react-text: 461 -->components/ProductList.js<!-- /react-text --></code><!-- react-text: 462 --> and typing:<!-- /react-text --></p><pre class="language-javascript" data-reactid="463"><code data-reactid="464"><span class="token keyword">import</span> React<span class="token punctuation">,</span> <span class="token punctuation">{</span> PropTypes <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'react'</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> Table<span class="token punctuation">,</span> Popconfirm<span class="token punctuation">,</span> Button <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'antd'</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> ProductList <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">{</span> onDelete<span class="token punctuation">,</span> products <span class="token punctuation">}</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">></span> <span class="token punctuation">{</span>
<span class="token keyword">const</span> columns <span class="token operator">=</span> <span class="token punctuation">[</span><span class="token punctuation">{</span>
title<span class="token punctuation">:</span> <span class="token string">'Name'</span><span class="token punctuation">,</span>
dataIndex<span class="token punctuation">:</span> <span class="token string">'name'</span><span class="token punctuation">,</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span> <span class="token punctuation">{</span>
title<span class="token punctuation">:</span> <span class="token string">'Actions'</span><span class="token punctuation">,</span>
render<span class="token punctuation">:</span> <span class="token punctuation">(</span>text<span class="token punctuation">,</span> record<span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">></span> <span class="token punctuation">{</span>
<span class="token keyword">return</span> <span class="token punctuation">(</span>
<span class="token operator">&lt;</span>Popconfirm title<span class="token operator">=</span><span class="token string">"Delete?"</span> onConfirm<span class="token operator">=</span><span class="token punctuation">{</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">></span> <span class="token function">onDelete</span><span class="token punctuation">(</span>record<span class="token punctuation">.</span>id<span class="token punctuation">)</span><span class="token punctuation">}</span><span class="token operator">></span>
<span class="token operator">&lt;</span>Button<span class="token operator">></span>Delete<span class="token operator">&lt;</span><span class="token operator">/</span>Button<span class="token operator">></span>
<span class="token operator">&lt;</span><span class="token operator">/</span>Popconfirm<span class="token operator">></span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">}</span><span class="token punctuation">]</span><span class="token punctuation">;</span>
<span class="token keyword">return</span> <span class="token punctuation">(</span>
<span class="token operator">&lt;</span>Table
dataSource<span class="token operator">=</span><span class="token punctuation">{</span>products<span class="token punctuation">}</span>
columns<span class="token operator">=</span><span class="token punctuation">{</span>columns<span class="token punctuation">}</span>
<span class="token operator">/</span><span class="token operator">></span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
ProductList<span class="token punctuation">.</span>proptypes <span class="token operator">=</span> <span class="token punctuation">{</span>
onDelete<span class="token punctuation">:</span> PropTypes<span class="token punctuation">.</span>func<span class="token punctuation">.</span>isRequired<span class="token punctuation">,</span>
products<span class="token punctuation">:</span> PropTypes<span class="token punctuation">.</span>array<span class="token punctuation">.</span>isRequired<span class="token punctuation">,</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token keyword">export</span> <span class="token keyword">default</span> ProductList<span class="token punctuation">;</span></code></pre><h2 id="Define-Model" data-reactid="465"><span data-reactid="466"><!-- react-text: 467 -->Define Model<!-- /react-text --></span><a href="#Define-Model" class="anchor" data-reactid="468">#</a></h2><p data-reactid="469"><!-- react-text: 470 -->After complete the UI, we will begin processing the data and logic.<!-- /react-text --></p><p data-reactid="471"><!-- react-text: 472 -->dva manages domain model with <!-- /react-text --><code data-reactid="473"><!-- react-text: 474 -->model<!-- /react-text --></code><!-- react-text: 475 -->, with reducers for synchronous state update, effects for async logic, and subscriptions for data source subscribe.<!-- /react-text --></p><p data-reactid="476"><!-- react-text: 477 -->Let&#x27;s create a model <!-- /react-text --><code data-reactid="478"><!-- react-text: 479 -->models/products.js<!-- /react-text --></code><!-- react-text: 480 --> and typing:<!-- /react-text --></p><pre class="language-javascript" data-reactid="481"><code data-reactid="482"><span class="token keyword">import</span> dva <span class="token keyword">from</span> <span class="token string">'dva'</span><span class="token punctuation">;</span>
<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token punctuation">{</span>
namespace<span class="token punctuation">:</span> <span class="token string">'products'</span><span class="token punctuation">,</span>
state<span class="token punctuation">:</span> <span class="token punctuation">[</span><span class="token punctuation">]</span><span class="token punctuation">,</span>
reducers<span class="token punctuation">:</span> <span class="token punctuation">{</span>
<span class="token string">'delete'</span><span class="token punctuation">(</span>state<span class="token punctuation">,</span> <span class="token punctuation">{</span> payload<span class="token punctuation">:</span> id <span class="token punctuation">}</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword">return</span> state<span class="token punctuation">.</span><span class="token function">filter</span><span class="token punctuation">(</span>item <span class="token operator">=</span><span class="token operator">></span> item<span class="token punctuation">.</span>id <span class="token operator">!==</span> id<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span></code></pre><p data-reactid="483"><!-- react-text: 484 -->In this model:<!-- /react-text --></p><ul data-reactid="485"><li data-reactid="486"><p data-reactid="487"><code data-reactid="488"><!-- react-text: 489 -->namespace<!-- /react-text --></code><!-- react-text: 490 --> represent the key on global state<!-- /react-text --></p></li><li data-reactid="491"><p data-reactid="492"><code data-reactid="493"><!-- react-text: 494 -->state<!-- /react-text --></code><!-- react-text: 495 --> is the initial value, here is an empty array<!-- /react-text --></p></li><li data-reactid="496"><p data-reactid="497"><code data-reactid="498"><!-- react-text: 499 -->reducers<!-- /react-text --></code><!-- react-text: 500 --> is equal to reducer in redux, accepting action, and update state synchronously<!-- /react-text --></p></li></ul><p data-reactid="501"><!-- react-text: 502 -->Then don&#x27;t forget to require it in <!-- /react-text --><code data-reactid="503"><!-- react-text: 504 -->index.js<!-- /react-text --></code><!-- react-text: 505 -->:<!-- /react-text --></p><pre class="language-diff" data-reactid="506"><code data-reactid="507">// 3. Model
<span class="token inserted">+ app.model(require('./models/products'));</span></code></pre><h2 id="Connect" data-reactid="508"><span data-reactid="509"><!-- react-text: 510 -->Connect<!-- /react-text --></span><a href="#Connect" class="anchor" data-reactid="511">#</a></h2><p data-reactid="512"><!-- react-text: 513 -->So far, we have completed a separate model and component. Then how to connect these together?<!-- /react-text --></p><p data-reactid="514"><!-- react-text: 515 -->dva provides a <!-- /react-text --><code data-reactid="516"><!-- react-text: 517 -->connect<!-- /react-text --></code><!-- react-text: 518 --> method. If you are familiar with redux, this <!-- /react-text --><code data-reactid="519"><!-- react-text: 520 -->connect<!-- /react-text --></code><!-- react-text: 521 --> is from react-router.<!-- /react-text --></p><p data-reactid="522"><!-- react-text: 523 -->Edit <!-- /react-text --><code data-reactid="524"><!-- react-text: 525 -->routes/Products.js<!-- /react-text --></code><!-- react-text: 526 --> and replace with following:<!-- /react-text --></p><pre class="language-javascript" data-reactid="527"><code data-reactid="528"><span class="token keyword">import</span> React <span class="token keyword">from</span> <span class="token string">'react'</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> connect <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'dva'</span><span class="token punctuation">;</span>
<span class="token keyword">import</span> ProductList <span class="token keyword">from</span> <span class="token string">'../components/ProductList'</span><span class="token punctuation">;</span>
<span class="token keyword">const</span> Products <span class="token operator">=</span> <span class="token punctuation">(</span><span class="token punctuation">{</span> dispatch<span class="token punctuation">,</span> products <span class="token punctuation">}</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">></span> <span class="token punctuation">{</span>
<span class="token keyword">function</span> <span class="token function">handleDelete</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token function">dispatch</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
type<span class="token punctuation">:</span> <span class="token string">'products/delete'</span><span class="token punctuation">,</span>
payload<span class="token punctuation">:</span> id<span class="token punctuation">,</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token keyword">return</span> <span class="token punctuation">(</span>
<span class="token operator">&lt;</span>div<span class="token operator">></span>
<span class="token operator">&lt;</span>h2<span class="token operator">></span>List <span class="token keyword">of</span> Products<span class="token operator">&lt;</span><span class="token operator">/</span>h2<span class="token operator">></span>
<span class="token operator">&lt;</span>ProductList onDelete<span class="token operator">=</span><span class="token punctuation">{</span>handleDelete<span class="token punctuation">}</span> products<span class="token operator">=</span><span class="token punctuation">{</span>products<span class="token punctuation">}</span> <span class="token operator">/</span><span class="token operator">></span>
<span class="token operator">&lt;</span><span class="token operator">/</span>div<span class="token operator">></span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token comment" spellcheck="true">// export default Products;</span>
<span class="token keyword">export</span> <span class="token keyword">default</span> <span class="token function">connect</span><span class="token punctuation">(</span><span class="token punctuation">(</span><span class="token punctuation">{</span> products <span class="token punctuation">}</span><span class="token punctuation">)</span> <span class="token operator">=</span><span class="token operator">></span> <span class="token punctuation">(</span><span class="token punctuation">{</span>
products<span class="token punctuation">,</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">)</span><span class="token punctuation">(</span>Products<span class="token punctuation">)</span><span class="token punctuation">;</span></code></pre><p data-reactid="529"><!-- react-text: 530 -->Finally, we need some initial data to make the application run together. Edit <!-- /react-text --><code data-reactid="531"><!-- react-text: 532 -->index.js<!-- /react-text --></code><!-- react-text: 533 -->:<!-- /react-text --></p><pre class="language-diff" data-reactid="534"><code data-reactid="535"><span class="token deleted">- const app = dva();</span>
<span class="token inserted">+ const app = dva({</span>
<span class="token inserted">+ initialState: {</span>
<span class="token inserted">+ products: [</span>
<span class="token inserted">+ { name: 'dva', id: 1 },</span>
<span class="token inserted">+ { name: 'antd', id: 2 },</span>
<span class="token inserted">+ ],</span>
<span class="token inserted">+ },</span>
<span class="token inserted">+ });</span></code></pre><p data-reactid="536"><!-- react-text: 537 -->Refresh your browser, you should see the following result:<!-- /react-text --></p><p style="text-align:center;" data-reactid="538"><img src="https://zos.alipayobjects.com/rmsportal/GQJeDDeUCSTRMMg.gif" data-reactid="539"/></p><h2 id="Build" data-reactid="540"><span data-reactid="541"><!-- react-text: 542 -->Build<!-- /react-text --></span><a href="#Build" class="anchor" data-reactid="543">#</a></h2><p data-reactid="544"><!-- react-text: 545 -->Now that we&#x27;ve written our application and verified that it works in development, it&#x27;s time to get it ready to deploy to our users. To do so, run the following command:<!-- /react-text --></p><pre class="language-bash" data-reactid="546"><code data-reactid="547">$ <span class="token function">npm</span> run build</code></pre><p data-reactid="548"><!-- react-text: 549 -->After a few seconds, the output should be as follows:<!-- /react-text --></p><pre class="language-bash" data-reactid="550"><code data-reactid="551"><span class="token operator">></span> @ build /private/tmp/myapp
<span class="token operator">></span> roadhog build
Creating an optimized production build<span class="token punctuation">..</span>.
Compiled successfully.
File sizes after gzip:
82.98 KB dist/index.js
270 B dist/index.css</code></pre><p data-reactid="552"><!-- react-text: 553 -->The <!-- /react-text --><code data-reactid="554"><!-- react-text: 555 -->build<!-- /react-text --></code><!-- react-text: 556 --> command packages up all of the assets that make up your application —— JavaScript, templates, CSS, web fonts, images, and more. Then you can find these files in the <!-- /react-text --><code data-reactid="557"><!-- react-text: 558 -->dist /<!-- /react-text --></code><!-- react-text: 559 --> directory.<!-- /react-text --></p><h2 id="What&#x27;s-Next" data-reactid="560"><span data-reactid="561"><!-- react-text: 562 -->What&#x27;s Next<!-- /react-text --></span><a href="#What&#x27;s-Next" class="anchor" data-reactid="563">#</a></h2><p data-reactid="564"><!-- react-text: 565 -->We have completed a simple application, but you may still have lots of questions, such as:<!-- /react-text --></p><ul data-reactid="566"><li data-reactid="567"><p data-reactid="568"><!-- react-text: 569 -->How to dealing with async logic<!-- /react-text --></p></li><li data-reactid="570"><p data-reactid="571"><!-- react-text: 572 -->How to load initial data elegantly<!-- /react-text --></p></li><li data-reactid="573"><p data-reactid="574"><!-- react-text: 575 -->How to handle onError globally and locally<!-- /react-text --></p></li><li data-reactid="576"><p data-reactid="577"><!-- react-text: 578 -->How to load Routes and Models on demand<!-- /react-text --></p></li><li data-reactid="579"><p data-reactid="580"><!-- react-text: 581 -->How to implement HMR<!-- /react-text --></p></li><li data-reactid="582"><p data-reactid="583"><!-- react-text: 584 -->How to mock data<!-- /react-text --></p></li><li data-reactid="585"><p data-reactid="586"><!-- react-text: 587 -->and so on...<!-- /react-text --></p></li></ul><p data-reactid="588"><!-- react-text: 589 -->You can:<!-- /react-text --></p><ul data-reactid="590"><li data-reactid="591"><p data-reactid="592"><!-- react-text: 593 -->Visit <!-- /react-text --><a href="https://github.com/dvajs/dva" data-reactid="594"><!-- react-text: 595 -->dva official website<!-- /react-text --></a><!-- react-text: 596 -->.<!-- /react-text --></p></li><li data-reactid="597"><p data-reactid="598"><!-- react-text: 599 -->View all the <!-- /react-text --><a href="https://github.com/dvajs/dva#api" data-reactid="600"><!-- react-text: 601 -->API<!-- /react-text --></a><!-- react-text: 602 -->.<!-- /react-text --></p></li><li data-reactid="603"><p data-reactid="604"><!-- react-text: 605 -->View <!-- /react-text --><a href="https://github.com/dvajs/dva-docs/blob/master/v1/zh-cn/tutorial/01-%E6%A6%82%E8%A6%81.md" data-reactid="606"><!-- react-text: 607 -->tutorial<!-- /react-text --></a><!-- react-text: 608 -->, complete a medium application step by step.<!-- /react-text --></p></li><li data-reactid="609"><p data-reactid="610"><!-- react-text: 611 -->View examples, such as <!-- /react-text --><a href="https://github.com/dvajs/dva-hackernews" data-reactid="612"><!-- react-text: 613 -->dva version of hackernews<!-- /react-text --></a><!-- react-text: 614 -->.<!-- /react-text --></p></li></ul></section></article></div></div><div class="ant-row" data-reactid="615"><div class="ant-col-xs-24 ant-col-sm-24 ant-col-md-18 ant-col-md-offset-6 ant-col-lg-20 ant-col-lg-offset-4" data-reactid="616"><section class="prev-next-nav" data-reactid="617"><a class="prev-page" href="/docs/react/install" data-reactid="618">Installation</a><a class="next-page" href="/docs/react/use-with-create-react-app" data-reactid="619">Use with create-react-app</a></section></div></div></div><footer id="footer" data-reactid="620"><ul data-reactid="621"><li data-reactid="622"><h2 data-reactid="623">GitHub</h2><div data-reactid="624"><a target="_blank " href="https://github.com/ant-design/ant-design" data-reactid="625"><span data-reactid="626"><!-- react-text: 627 -->Repository<!-- /react-text --></span></a></div><div data-reactid="628"><a target="_blank" rel="noopener noreferrer" href="https://github.com/dvajs/dva" data-reactid="629">dva</a><!-- react-text: 630 --> - <!-- /react-text --><span data-reactid="631"><!-- react-text: 632 -->Framework<!-- /react-text --></span></div><div data-reactid="633"><a target="_blank" rel="noopener noreferrer" href="https://github.com/dvajs/dva-cli" data-reactid="634">dva-cli</a><!-- react-text: 635 --> -<!-- /react-text --><span data-reactid="636"><!-- react-text: 637 -->Scaffold<!-- /react-text --></span></div><div data-reactid="638"><a target="_blank" rel="noopener noreferrer" href="http://ant-tool.github.io" data-reactid="639">ant-tool</a><!-- react-text: 640 --> - <!-- /react-text --><span data-reactid="641"><!-- react-text: 642 -->Developer Tools<!-- /react-text --></span></div></li><li data-reactid="643"><h2 data-reactid="644"><span data-reactid="645"><!-- react-text: 646 -->Links<!-- /react-text --></span></h2><div data-reactid="647"><a href="http://mobile.ant.design" data-reactid="648">Ant Design Mobile</a><span data-reactid="649"> - </span><span data-reactid="650"><!-- react-text: 651 -->Mobile<!-- /react-text --></span></div><div data-reactid="652"><a href="https://g2.alipay.com/" data-reactid="653">G2</a><span data-reactid="654"> - </span><span data-reactid="655"><!-- react-text: 656 -->Data Visualization<!-- /react-text --></span></div><div data-reactid="657"><a href="https://antv.alipay.com/" data-reactid="658">AntV</a><span data-reactid="659"> - </span><span data-reactid="660"><!-- react-text: 661 -->Data Visualization Specification<!-- /react-text --></span></div><div data-reactid="662"><a href="http://motion.ant.design" data-reactid="663">Ant Motion</a><span data-reactid="664"> - </span><span data-reactid="665"><!-- react-text: 666 -->Motion<!-- /react-text --></span></div><div data-reactid="667"><a href="http://library.ant.design/" data-reactid="668">AntD Library</a><span data-reactid="669"> - </span><span data-reactid="670"><!-- react-text: 671 -->Axure library of Ant Design<!-- /react-text --></span></div><div data-reactid="672"><a href="http://ux.ant.design" data-reactid="673">Ant UX</a><span data-reactid="674"> - </span><span data-reactid="675"><!-- react-text: 676 -->Sitemap Template<!-- /react-text --></span></div></li><li data-reactid="677"><h2 data-reactid="678"><span data-reactid="679"><!-- react-text: 680 -->Community<!-- /react-text --></span></h2><div data-reactid="681"><a rel="noopener noreferrer" href="/changelog" data-reactid="682"><span data-reactid="683"><!-- react-text: 684 -->Change Log<!-- /react-text --></span></a></div><div data-reactid="685"><a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design/ant-design/issues" data-reactid="686"><span data-reactid="687"><!-- react-text: 688 -->Feedback<!-- /react-text --></span></a></div><div data-reactid="689"><a target="_blank" rel="noopener noreferrer" href="https://gitter.im/ant-design/ant-design" data-reactid="690"><span data-reactid="691"><!-- react-text: 692 -->Chat Room<!-- /react-text --></span></a></div><div data-reactid="693"><a target="_blank" rel="noopener noreferrer" href="https://github.com/ant-design/ant-design/issues/new" data-reactid="694"><span data-reactid="695"><!-- react-text: 696 -->Bug Report<!-- /react-text --></span></a></div></li><li data-reactid="697"><div data-reactid="698"><!-- react-text: 699 -->©2016 <!-- /react-text --><span data-reactid="700"><!-- react-text: 701 -->Created by Ant UED<!-- /react-text --></span></div><div data-reactid="702"><!-- react-text: 703 -->Powered by <!-- /react-text --><a href="https://github.com/benjycui/bisheng" data-reactid="704">BiSheng</a></div><div style="margin-top:10px;" data-reactid="705"><span data-reactid="706"><!-- react-text: 707 -->Version: <!-- /react-text --></span><div class="ant-select-sm ant-select ant-select-enabled" data-reactid="708"><div class="ant-select-selection
ant-select-selection--single" role="combobox" aria-autocomplete="list" aria-haspopup="true" aria-expanded="false" tabindex="0" data-reactid="709"><div class="ant-select-selection__rendered" data-reactid="710"><div class="ant-select-selection-selected-value" title="1.11.4" style="display:block;opacity:1;" data-reactid="711">1.11.4</div></div><span class="ant-select-arrow" style="user-select:none;-webkit-user-select:none;" unselectable="unselectable" data-reactid="712"><b data-reactid="713"></b></span></div></div></div></li></ul></footer></div>
</div>
<script>
function isZhCN(pathname) {
return /-cn\/?$/.test(pathname);
}
function getLocalizedPathname(path, zhCN) {
var pathname = path.startsWith('/') ? path : '/' + path;
if (!zhCN) { // to enUS
return /\/?index-cn/.test(pathname) ? '/' : pathname.replace('-cn', '');
} else if (pathname === '/') {
return '/index-cn';
} else if (pathname.endsWith('/')) {
return pathname.replace(/\/$/, '-cn/');
}
return pathname + '-cn';
}
var queryString = location.search;
if (queryString) {
var pathname = location.pathname;
var isZhCNConfig = queryString.indexOf('zh-CN') > -1;
if (isZhCNConfig !== isZhCN(pathname)) {
location.pathname = getLocalizedPathname(pathname, isZhCNConfig)
}
}
</script>
<script>
// Enable Google Analytics
if (!location.port) {
/* eslint-disable */
(function (i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r;
i[r] = i[r] || function () {
(i[r].q = i[r].q || []).push(arguments)
}, i[r].l = 1 * new Date();
a = s.createElement(o),
m = s.getElementsByTagName(o)[0];
a.async = 1;
a.src = g;
m.parentNode.insertBefore(a, m)
})(window, document, 'script', '//www.google-analytics.com/analytics.js', 'ga');
ga('create', 'UA-72788897-1', 'auto');
ga('send', 'pageview');
/* eslint-enable */
}
</script>
<script src="/common.js"></script>
<script src="/index.js"></script>
</body>
</html>