mirror of
https://github.com/wahyd4/ant-design.git
synced 2026-08-14 15:25:56 +10:00
725 lines
27 KiB
HTML
725 lines
27 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="apple-mobile-web-app-capable" content="yes">
|
|
<meta name="apple-mobile-web-app-status-bar-style" content="black">
|
|
<meta name="format-detection" content="telephone=no">
|
|
<meta name="description" content="一个 UI 设计语言"/>
|
|
<title>
|
|
快速上手 - Ant Design
|
|
</title>
|
|
<link rel="icon" href="https://t.alipayobjects.com/images/T1QUBfXo4fXXXXXXXX.png" type="image/x-icon">
|
|
<link rel="shortcut icon" href="https://t.alipayobjects.com/images/T1QUBfXo4fXXXXXXXX.png" type="image/x-icon">
|
|
|
|
<link rel="stylesheet" href="../../dist/demo.css?20160114">
|
|
<script src="https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,es5-shim/4.5.7/es5-shim.min.js,es5-shim/4.5.7/es5-sham.min.js,html5shiv/3.7.2/html5shiv.min.js,media-match/2.0.2/media.match.min.js,jquery/1.11.3/jquery.min.js,bluebird/3.1.1/bluebird.min.js"></script>
|
|
<script>
|
|
(function() {
|
|
window.ANT_COMPONENTS = [];
|
|
window.InstantClickChangeFns = [];
|
|
ANT_COMPONENTS.push({
|
|
title: 'Pagination',
|
|
desc: '分页'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Affix',
|
|
desc: '固钉'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Badge',
|
|
desc: '徽标数'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Breadcrumb',
|
|
desc: '面包屑'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Button',
|
|
desc: '按钮'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Calendar',
|
|
desc: '日历'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Carousel',
|
|
desc: '走马灯'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Cascader',
|
|
desc: '级联选择'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Checkbox',
|
|
desc: '多选框'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Collapse',
|
|
desc: '折叠面板'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'DatePicker',
|
|
desc: '日期选择框'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Dropdown',
|
|
desc: '下拉菜单'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Form',
|
|
desc: '表单'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Icon',
|
|
desc: '图标'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'InputNumber',
|
|
desc: '数字输入框'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Layout',
|
|
desc: '布局'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Menu',
|
|
desc: '导航菜单'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Message',
|
|
desc: '全局提示'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Modal',
|
|
desc: '对话框'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Notification',
|
|
desc: '通知提醒框'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Alert',
|
|
desc: '警告提示'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Popconfirm',
|
|
desc: '气泡确认框'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Popover',
|
|
desc: '气泡卡片'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Progress',
|
|
desc: '进度条'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'QueueAnim',
|
|
desc: '进出场动画'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Radio',
|
|
desc: '单选框'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Select',
|
|
desc: '选择器'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Slider',
|
|
desc: '滑动输入条'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Spin',
|
|
desc: '加载中'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Steps',
|
|
desc: '步骤条'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Switch',
|
|
desc: '开关'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Table',
|
|
desc: '表格'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Tabs',
|
|
desc: '标签页'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Tag',
|
|
desc: '标签'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'TimePicker',
|
|
desc: '时间选择框'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Timeline',
|
|
desc: '时间轴'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Tooltip',
|
|
desc: '文字提示'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Transfer',
|
|
desc: '穿梭框'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Tree',
|
|
desc: '树形控件'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'TreeSelect',
|
|
desc: '树选择'
|
|
});
|
|
ANT_COMPONENTS.push({
|
|
title: 'Upload',
|
|
desc: '上传'
|
|
});
|
|
// fix ie location origin
|
|
// http://stackoverflow.com/questions/22564167/window-location-origin-gives-wrong-value-when-using-ie
|
|
if (!window.location.origin) {
|
|
window.location.origin = window.location.protocol + "//"
|
|
+ window.location.hostname
|
|
+ (window.location.port ? ':' + window.location.port : '');
|
|
}
|
|
var i = location.pathname.split('/').lastIndexOf('ant-design');
|
|
if (i > 0) {
|
|
window.rootUrl = location.origin + location.pathname.split('/').slice(0, 2+1).join('/');
|
|
} else {
|
|
window.rootUrl = location.origin;
|
|
}
|
|
})();
|
|
</script>
|
|
<script>
|
|
window.antdVersion = {
|
|
latest: '0.12.11'
|
|
};
|
|
</script>
|
|
<script src="../../dist/demo.js?20160114"></script>
|
|
|
|
</head>
|
|
<body >
|
|
<header id="header" class="clearfix">
|
|
<a class="logo" href="../..">
|
|
<img width="60" src="https://t.alipayobjects.com/images/rmsweb/T1B9hfXcdvXXXXXXXX.svg">
|
|
Ant Design
|
|
</a>
|
|
<div class="search">
|
|
<div id="autoComplete"></div>
|
|
</div>
|
|
<nav class="nav" tabindex="-1">
|
|
<span class="bar"></span>
|
|
<ul>
|
|
<li class="">
|
|
<a href="../..">首页</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../practice/cases">实践</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../pattern/navigation">模式</a>
|
|
</li>
|
|
<li class="current">
|
|
<a href="./introduce">组件</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../spec/introduce">语言</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../resource/download">资源</a>
|
|
</li>
|
|
</ul>
|
|
</nav>
|
|
<div class="nav-phone-icon"></div>
|
|
</header>
|
|
<div class="main-wrapper">
|
|
|
|
<aside class="aside-container">
|
|
<ul>
|
|
<li class="">
|
|
<a href="introduce"
|
|
class="">
|
|
Ant Design of React
|
|
<span class="chinese"></span>
|
|
</a>
|
|
</li>
|
|
<li class="current">
|
|
<a href="getting-started"
|
|
class="">
|
|
快速上手
|
|
<span class="chinese"></span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="install"
|
|
class="">
|
|
安装
|
|
<span class="chinese"></span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="upgrade-notes"
|
|
class="">
|
|
升级指南
|
|
<span class="chinese"></span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../changelog"
|
|
class="">
|
|
更新日志
|
|
<span class="chinese"></span>
|
|
</a>
|
|
</li>
|
|
<li open="open">
|
|
<h4>Components</h4>
|
|
<ul class="">
|
|
<li class="type-divider">基本</li>
|
|
<li class="">
|
|
<a href="../../components/button/"
|
|
class="">
|
|
Button
|
|
<span class="chinese">按钮</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/icon/"
|
|
class="">
|
|
Icon
|
|
<span class="chinese">图标</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/layout/"
|
|
class="">
|
|
Layout
|
|
<span class="chinese">布局</span>
|
|
</a>
|
|
</li>
|
|
<li class="type-divider">表单</li>
|
|
<li class="">
|
|
<a href="../../components/cascader/"
|
|
class="">
|
|
Cascader
|
|
<span class="chinese">级联选择</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/checkbox/"
|
|
class="">
|
|
Checkbox
|
|
<span class="chinese">多选框</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/date-picker/"
|
|
class="">
|
|
DatePicker
|
|
<span class="chinese">日期选择框</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/form/"
|
|
class="">
|
|
Form
|
|
<span class="chinese">表单</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/input-number/"
|
|
class="">
|
|
InputNumber
|
|
<span class="chinese">数字输入框</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/radio/"
|
|
class="">
|
|
Radio
|
|
<span class="chinese">单选框</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/select/"
|
|
class="">
|
|
Select
|
|
<span class="chinese">选择器</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/slider/"
|
|
class="">
|
|
Slider
|
|
<span class="chinese">滑动输入条</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/switch/"
|
|
class="">
|
|
Switch
|
|
<span class="chinese">开关</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/time-picker/"
|
|
class="">
|
|
TimePicker
|
|
<span class="chinese">时间选择框</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/transfer/"
|
|
class="">
|
|
Transfer
|
|
<span class="chinese">穿梭框</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/tree-select/"
|
|
class="">
|
|
TreeSelect
|
|
<span class="chinese">树选择</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/upload/"
|
|
class="">
|
|
Upload
|
|
<span class="chinese">上传</span>
|
|
</a>
|
|
</li>
|
|
<li class="type-divider">展示</li>
|
|
<li class="">
|
|
<a href="../../components/alert/"
|
|
class="">
|
|
Alert
|
|
<span class="chinese">警告提示</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/badge/"
|
|
class="">
|
|
Badge
|
|
<span class="chinese">徽标数</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/calendar/"
|
|
class="">
|
|
Calendar
|
|
<span class="chinese">日历</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/carousel/"
|
|
class="">
|
|
Carousel
|
|
<span class="chinese">走马灯</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/collapse/"
|
|
class="">
|
|
Collapse
|
|
<span class="chinese">折叠面板</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/dropdown/"
|
|
class="">
|
|
Dropdown
|
|
<span class="chinese">下拉菜单</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/message/"
|
|
class=""data-no-instant>
|
|
Message
|
|
<span class="chinese">全局提示</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/modal/"
|
|
class="">
|
|
Modal
|
|
<span class="chinese">对话框</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/notification/"
|
|
class=""data-no-instant>
|
|
Notification
|
|
<span class="chinese">通知提醒框</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/popconfirm/"
|
|
class="">
|
|
Popconfirm
|
|
<span class="chinese">气泡确认框</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/popover/"
|
|
class="">
|
|
Popover
|
|
<span class="chinese">气泡卡片</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/progress/"
|
|
class="">
|
|
Progress
|
|
<span class="chinese">进度条</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/table/"
|
|
class="">
|
|
Table
|
|
<span class="chinese">表格</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/tag/"
|
|
class="">
|
|
Tag
|
|
<span class="chinese">标签</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/timeline/"
|
|
class="">
|
|
Timeline
|
|
<span class="chinese">时间轴</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/tooltip/"
|
|
class="">
|
|
Tooltip
|
|
<span class="chinese">文字提示</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/tree/"
|
|
class="">
|
|
Tree
|
|
<span class="chinese">树形控件</span>
|
|
</a>
|
|
</li>
|
|
<li class="type-divider">导航</li>
|
|
<li class="">
|
|
<a href="../../components/breadcrumb/"
|
|
class="">
|
|
Breadcrumb
|
|
<span class="chinese">面包屑</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/menu/"
|
|
class="">
|
|
Menu
|
|
<span class="chinese">导航菜单</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/pagination/"
|
|
class="">
|
|
Pagination
|
|
<span class="chinese">分页</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/steps/"
|
|
class="">
|
|
Steps
|
|
<span class="chinese">步骤条</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/tabs/"
|
|
class="">
|
|
Tabs
|
|
<span class="chinese">标签页</span>
|
|
</a>
|
|
</li>
|
|
<li class="type-divider">其他</li>
|
|
<li class="">
|
|
<a href="../../components/affix/"
|
|
class="">
|
|
Affix
|
|
<span class="chinese">固钉</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/queue-anim/"
|
|
class="">
|
|
QueueAnim
|
|
<span class="chinese">进出场动画</span>
|
|
</a>
|
|
</li>
|
|
<li class="">
|
|
<a href="../../components/spin/"
|
|
class="">
|
|
Spin
|
|
<span class="chinese">加载中</span>
|
|
</a>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</aside>
|
|
|
|
<section class="main-container">
|
|
<article class="markdown">
|
|
<h1>快速上手 <span class="subtitle"></span></h1>
|
|
|
|
<p>Ant Design React 致力于提供给程序员<strong>愉悦</strong>的开发体验。</p>
|
|
|
|
<div class="toc"><ul><li><a href="#第一个例子">第一个例子</a></li><li><a href="#标准开发">标准开发</a><ul><li><a href="#1-安装脚手架工具">1. 安装脚手架工具</a></li><li><a href="#2-创建一个项目">2. 创建一个项目</a></li><li><a href="#3-使用组件">3. 使用组件</a></li><li><a href="#4-开发调试">4. 开发调试</a></li><li><a href="#5-构建和部署">5. 构建和部署</a></li></ul></li><li><a href="#兼容性">兼容性</a></li><li><a href="#自行构建">自行构建</a><ul><li><a href="#改变主色系">改变主色系</a></li></ul></li><li><a href="#小甜点">小甜点</a></li></ul></div>
|
|
<h2 id="第一个例子">第一个例子<a href="#第一个例子" class="anchor">#</a> </h2><p>最简单的试用方式参照以下 CodePen 演示,也推荐 Fork 本例来进行 <code>Bug Report</code>,注意不要在实际项目中这样使用。</p>
|
|
<ul>
|
|
<li><a href="http://codepen.io/anon/pen/pgdXYp?editors=001">antd CodePen</a></li>
|
|
</ul>
|
|
<h2 id="标准开发">标准开发<a href="#标准开发" class="anchor">#</a> </h2><p>实际项目开发中,你会需要对 ES2015 和 JSX 代码的构建、调试、代理、打包部署等一系列工程化的需求。
|
|
我们提供了一套 <code>npm</code> + <code>webpack</code> 的开发工具链来辅助开发,下面我们用一个简单的实例来说明。</p>
|
|
<h3 id="1-安装脚手架工具">1. 安装脚手架工具<a href="#1-安装脚手架工具" class="anchor">#</a> </h3><blockquote>
|
|
<p>使用 <code>antd-init</code> 前,务必确认 <a href="https://nodejs.org/en/">Node.js</a> 已经升级到 v4.x 或以上。</p>
|
|
</blockquote>
|
|
<div class="highlight"><pre><code class="bash">$ npm install antd-init -g</code></pre></div><p>更多功能请参考 <a href="https://github.com/ant-design/antd-init/">脚手架工具</a> 和 <a href="http://ant-tool.github.io/">开发工具文档</a>。</p>
|
|
<h3 id="2-创建一个项目">2. 创建一个项目<a href="#2-创建一个项目" class="anchor">#</a> </h3><p>使用命令行进行初始化。</p>
|
|
<div class="highlight"><pre><code class="bash">$ mkdir antd-demo && <span class="hljs-built_in">cd</span> antd-demo
|
|
$ antd-init
|
|
$ npm install</code></pre></div><p>若安装缓慢报错,可尝试用 <code>cnpm</code> 或别的镜像源自行安装:<code>rm -rf node_modules && cnpm install</code>.</p>
|
|
<h3 id="3-使用组件">3. 使用组件<a href="#3-使用组件" class="anchor">#</a> </h3><p>编辑 <code>src/component/App.jsx</code>,用 React 的方式直接使用 Ant Design React 的组件。</p>
|
|
<div class="highlight"><pre><code class="javascript"><span class="hljs-keyword">import</span> React <span class="hljs-keyword">from</span> <span class="hljs-string">'react'</span>;
|
|
<span class="hljs-keyword">import</span> { DatePicker, message } <span class="hljs-keyword">from</span> <span class="hljs-string">'antd'</span>;
|
|
|
|
<span class="hljs-keyword">const</span> App = React.createClass({
|
|
getInitialState() {
|
|
<span class="hljs-keyword">return</span> {
|
|
date: <span class="hljs-string">''</span>
|
|
};
|
|
},
|
|
handleChange(value) {
|
|
message.info(<span class="hljs-string">'您选择的日期是: '</span> + value.toString());
|
|
<span class="hljs-keyword">this</span>.setState({
|
|
date: value
|
|
});
|
|
},
|
|
render() {
|
|
<span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">style</span>=<span class="hljs-value">{{width:</span> <span class="hljs-attribute">400</span>, <span class="hljs-attribute">margin:</span> '<span class="hljs-attribute">100px</span> <span class="hljs-attribute">auto</span>'}}></span>
|
|
<span class="hljs-tag"><<span class="hljs-title">DatePicker</span> <span class="hljs-attribute">onChange</span>=<span class="hljs-value">{this.handleChange}</span> /></span>
|
|
<span class="hljs-tag"><<span class="hljs-title">div</span> <span class="hljs-attribute">style</span>=<span class="hljs-value">{{marginTop:</span> <span class="hljs-attribute">20</span>}}></span>当前日期:{this.state.date.toString()}<span class="hljs-tag"></<span class="hljs-title">div</span>></span>
|
|
<span class="hljs-tag"></<span class="hljs-title">div</span>></span>;</span>
|
|
}
|
|
});
|
|
|
|
<span class="hljs-keyword">export</span> <span class="hljs-keyword">default</span> App;</code></pre></div><p>你可以在 <a href="/components/button">这里</a> 选用更多组件。</p>
|
|
<h3 id="4-开发调试">4. 开发调试<a href="#4-开发调试" class="anchor">#</a> </h3><p>一键启动调试,访问 <a href="http://127.0.0.1:8989">http://127.0.0.1:8989</a> 查看效果。</p>
|
|
<div class="highlight"><pre><code class="bash">$ npm run dev</code></pre></div><h3 id="5-构建和部署">5. 构建和部署<a href="#5-构建和部署" class="anchor">#</a> </h3><div class="highlight"><pre><code class="bash">$ npm run build</code></pre></div><p>入口文件会构建到 <code>dist</code> 目录中,你可以自由部署到不同环境中进行引用。</p>
|
|
<blockquote>
|
|
<p>上述例子用于帮助你理解 Ant Design React 的使用流程,并非真实的开发过程,你可以根据自己的项目开发流程进行接入。</p>
|
|
</blockquote>
|
|
<h2 id="兼容性">兼容性<a href="#兼容性" class="anchor">#</a> </h2><p>Ant Design React 支持所有的现代浏览器和 IE8+。</p>
|
|
<p>对于 IE8,需要提供 <a href="http://facebook.github.io/react/docs/working-with-the-browser.html#browser-support-and-polyfills">es5-shim</a> 等 Polyfills 的支持。</p>
|
|
<div class="code-line-highlight"></div>
|
|
|
|
<style>
|
|
.code-line-highlight {
|
|
box-shadow: 0px 184px 0px rgba(255, 207, 0, 0.16);
|
|
height: 42px;
|
|
margin-top: -42px;
|
|
position: relative;
|
|
z-index: 1;
|
|
width: 80%;
|
|
}
|
|
</style>
|
|
|
|
<div class="highlight"><pre><code class="xml"><span class="hljs-doctype"><!DOCTYPE html></span>
|
|
<span class="hljs-tag"><<span class="hljs-title">html</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-title">head</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-title">meta</span> <span class="hljs-attribute">charset</span>=<span class="hljs-value">"utf-8"</span>></span>
|
|
<span class="hljs-comment"><!-- 引入样式 --></span>
|
|
<span class="hljs-tag"><<span class="hljs-title">link</span> <span class="hljs-attribute">rel</span>=<span class="hljs-value">"stylesheet"</span> <span class="hljs-attribute">href</span>=<span class="hljs-value">"/index.css"</span>></span>
|
|
<span class="hljs-comment"><!-- Polyfills --></span>
|
|
<span class="hljs-tag"><<span class="hljs-title">script</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">"https://as.alipayobjects.com/g/component/??console-polyfill/0.2.2/index.js,es5-shim/4.5.7/es5-shim.min.js,es5-shim/4.5.7/es5-sham.min.js,html5shiv/3.7.2/html5shiv.min.js,media-match/2.0.2/media.match.min.js"</span>></span><span class="undefined"></span><span class="hljs-tag"></<span class="hljs-title">script</span>></span>
|
|
<span class="hljs-tag"></<span class="hljs-title">head</span>></span>
|
|
<span class="hljs-tag"><<span class="hljs-title">body</span>></span>
|
|
<span class="hljs-tag"></<span class="hljs-title">body</span>></span>
|
|
<span class="hljs-comment"><!-- 引入公用文件 --></span>
|
|
<span class="hljs-tag"><<span class="hljs-title">script</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">"/common.js"</span>></span><span class="undefined"></span><span class="hljs-tag"></<span class="hljs-title">script</span>></span>
|
|
<span class="hljs-comment"><!-- 引入入口文件 --></span>
|
|
<span class="hljs-tag"><<span class="hljs-title">script</span> <span class="hljs-attribute">src</span>=<span class="hljs-value">"/index.js"</span>></span><span class="undefined"></span><span class="hljs-tag"></<span class="hljs-title">script</span>></span>
|
|
<span class="hljs-tag"></<span class="hljs-title">html</span>></span></code></pre></div><blockquote>
|
|
<p>更多 IE8 下使用 React 的相关问题可以参考:<a href="https://github.com/xcatliu/react-ie8">https://github.com/xcatliu/react-ie8</a></p>
|
|
</blockquote>
|
|
<h2 id="自行构建">自行构建<a href="#自行构建" class="anchor">#</a> </h2><p>如果想自己维护工作流,我们推荐使用 <a href="http://webpack.github.io/">webpack</a> 进行构建和调试。理论上你可以利用 React 生态圈中的 <a href="https://github.com/enaqx/awesome-react#boilerplates">各种脚手架</a> 进行开发,如果遇到问题可参考我们所使用的 <a href="https://github.com/ant-tool/atool-build/blob/master/src/getWebpackCommonConfig.js">webpack 配置</a> 进行 <a href="http://ant-tool.github.io/webpack-config.htm">定制</a>。</p>
|
|
<h3 id="改变主色系">改变主色系<a href="#改变主色系" class="anchor">#</a> </h3><ul>
|
|
<li><a href="https://github.com/ant-design/antd-init/tree/master/examples/customize-antd-theme">配置代码示例</a></li>
|
|
</ul>
|
|
<h2 id="小甜点">小甜点<a href="#小甜点" class="anchor">#</a> </h2><ul>
|
|
<li>你可以享用 <code>npm</code> 生态圈里的所有模块。</li>
|
|
<li>我们使用了 <code>babel</code>,试试用 <a href="http://babeljs.io/blog/2015/06/07/react-on-es6-plus/">ES6</a> 的写法来提升编码的愉悦感。</li>
|
|
</ul>
|
|
|
|
</article>
|
|
</section>
|
|
|
|
</div><footer id="footer">
|
|
<ul>
|
|
<li>
|
|
<h2>GitHub</h2>
|
|
<a target="_blank "href="https://github.com/ant-design/ant-design">仓库</a>
|
|
<a target="_blank" href="https://github.com/ant-design/antd-init">脚手架</a>
|
|
<a target="_blank" href="http://ant-tool.github.io/">开发工具</a>
|
|
</li>
|
|
<li>
|
|
<h2>关于我们</h2>
|
|
<a target="_blank" href="https://github.com/ant-ued/blog">博客 - Ant UED</a>
|
|
</li>
|
|
<li>
|
|
<h2>联系我们</h2>
|
|
<a target="_blank" href="https://github.com/ant-design/ant-design/issues">反馈和建议</a>
|
|
<a target="_blank" href="https://gitter.im/ant-design/ant-design">讨论</a>
|
|
<a target="_blank" href="http://dwz.cn/2AF9ao">报告 Bug</a>
|
|
</li>
|
|
<li>
|
|
<div>©2015 蚂蚁金服体验技术部出品</div>
|
|
<div>文档版本:<span id="versions-select"></span></div>
|
|
</li>
|
|
</ul>
|
|
</footer>
|
|
<script data-no-instant>
|
|
if (!location.port) {
|
|
(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');
|
|
InstantClick.on('change', function() {
|
|
ga('send', 'pageview', location.pathname + location.search);
|
|
});
|
|
}
|
|
</script>
|
|
<script data-no-instant>
|
|
InstantClick.on('change', function() {
|
|
InstantClickChangeFns.forEach(function(fn) {
|
|
fn();
|
|
});
|
|
});
|
|
InstantClick.init();
|
|
</script>
|
|
</body>
|
|
</html> |