ES6 syntax for demo code

fix antd.notification
This commit is contained in:
afc163 2015-10-28 20:55:49 +08:00
parent dffbda521c
commit 753c01ae18
160 changed files with 432 additions and 519 deletions

View File

@ -7,8 +7,7 @@
--- ---
````jsx ````jsx
var Affix = antd.Affix; import { Affix, Button } from 'antd';
var Button = antd.Button;
ReactDOM.render( ReactDOM.render(
<Affix> <Affix>

View File

@ -7,8 +7,7 @@
--- ---
````jsx ````jsx
var Affix = antd.Affix; import { Affix, Button } from 'antd';
var Button = antd.Button;
ReactDOM.render( ReactDOM.render(
<Affix offset={75}> <Affix offset={75}>

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Alert = antd.Alert; import { Alert } from 'antd';
ReactDOM.render(<Alert message="成功提示的文案" type="success" /> ReactDOM.render(<Alert message="成功提示的文案" type="success" />
, document.getElementById('components-alert-demo-basic')); , document.getElementById('components-alert-demo-basic'));

View File

@ -7,9 +7,9 @@
--- ---
````jsx ````jsx
var Alert = antd.Alert; import { Alert } from 'antd';
var onClose = function(e) { const onClose = function(e) {
console.log(e, '我要被关闭啦!'); console.log(e, '我要被关闭啦!');
}; };

View File

@ -7,8 +7,8 @@
--- ---
````jsx ````jsx
var Alert = antd.Alert; import { Alert } from 'antd';
var link = <a href="javascript:;">不再提醒</a> const link = <a href="javascript:;">不再提醒</a>;
ReactDOM.render( ReactDOM.render(
<Alert message="消息提示的文案" type="info" closeText={link} /> <Alert message="消息提示的文案" type="info" closeText={link} />

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Alert = antd.Alert; import { Alert } from 'antd';
ReactDOM.render(<div> ReactDOM.render(<div>
<Alert message="成功提示的文案" <Alert message="成功提示的文案"

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Alert = antd.Alert; import { Alert } from 'antd';
ReactDOM.render(<div> ReactDOM.render(<div>
<Alert message="成功提示的文案" type="success" /> <Alert message="成功提示的文案" type="success" />

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Badge = antd.Badge; import { Badge } from 'antd';
ReactDOM.render(<div> ReactDOM.render(<div>
<Badge count="99"> <Badge count="99">

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Badge = antd.Badge; import { Badge } from 'antd';
ReactDOM.render( ReactDOM.render(
<Badge count="5"> <Badge count="5">

View File

@ -7,8 +7,7 @@
--- ---
````jsx ````jsx
var Badge = antd.Badge; import { Badge, Icon } from 'antd';
var Icon = antd.Icon;
ReactDOM.render(<div> ReactDOM.render(<div>
<Badge dot={true}> <Badge dot={true}>

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Badge = antd.Badge; import { Badge } from 'antd';
ReactDOM.render( ReactDOM.render(
<a href="#"> <a href="#">

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Breadcrumb = require('antd/lib/breadcrumb'); import { Breadcrumb } from 'antd';
ReactDOM.render( ReactDOM.render(
<Breadcrumb> <Breadcrumb>

View File

@ -7,13 +7,11 @@
--- ---
````jsx ````jsx
var ReactRouter = require('react-router'); const ReactRouter = require('react-router');
var Router = ReactRouter.Router; let { Router, Route, Link } = ReactRouter;
var Route = ReactRouter.Route; import { Breadcrumb } from 'antd';
var Link = ReactRouter.Link;
var Breadcrumb = require('antd').Breadcrumb;
var Apps = React.createClass({ const Apps = React.createClass({
render() { render() {
return <ul className="app-list"> return <ul className="app-list">
<li><Link to="/apps/1">应用1</Link></li> <li><Link to="/apps/1">应用1</Link></li>
@ -22,7 +20,7 @@ var Apps = React.createClass({
} }
}); });
var Home = React.createClass({ const Home = React.createClass({
render() { render() {
return (<div> return (<div>
<div className="demo-nav"> <div className="demo-nav">

View File

@ -7,8 +7,7 @@
--- ---
````jsx ````jsx
var Breadcrumb = require('antd/lib/breadcrumb'); import { Breadcrumb, Icon } from 'antd';
var Icon = require('antd').iconfont;
ReactDOM.render( ReactDOM.render(
<Breadcrumb> <Breadcrumb>

View File

@ -11,7 +11,7 @@
--- ---
````jsx ````jsx
var Button = antd.Button; import { Button } from 'antd';
ReactDOM.render(<div> ReactDOM.render(<div>
<Button type="primary">主按钮</Button> <Button type="primary">主按钮</Button>

View File

@ -9,9 +9,7 @@
--- ---
````jsx ````jsx
var Button = antd.Button; import { Button, ButtonGroup, Icon } from 'antd';
var ButtonGroup = antd.ButtonGroup;
var Icon = antd.Icon;
ReactDOM.render(<div> ReactDOM.render(<div>
<h4>基本组合</h4> <h4>基本组合</h4>
@ -31,7 +29,7 @@ ReactDOM.render(<div>
<Button></Button> <Button></Button>
</ButtonGroup> </ButtonGroup>
<h4>带图标按钮组合 </h4> <h4>带图标按钮组合</h4>
<ButtonGroup> <ButtonGroup>
<Button type="primary"> <Button type="primary">
<Icon type="left" /> <Icon type="left" />

View File

@ -7,8 +7,7 @@
--- ---
````jsx ````jsx
var Button = antd.Button; import { Button, Icon } from 'antd';
var Icon = antd.Icon;
ReactDOM.render(<div> ReactDOM.render(<div>
<Button type="primary" shape="circle" size="large"> <Button type="primary" shape="circle" size="large">

View File

@ -7,9 +7,9 @@
--- ---
````jsx ````jsx
var Button = antd.Button; import { Button } from 'antd';
var App = React.createClass({ const App = React.createClass({
getInitialState() { getInitialState() {
return { return {
loading: false loading: false

View File

@ -7,8 +7,7 @@
--- ---
````jsx ````jsx
var Button = antd.Button; import { Button, Icon } from 'antd';
var Icon = antd.Icon;
ReactDOM.render(<div> ReactDOM.render(<div>
<Button type="primary" shape="circle" size="large"> <Button type="primary" shape="circle" size="large">

View File

@ -9,7 +9,7 @@
--- ---
````jsx ````jsx
var Button = antd.Button; import { Button } from 'antd';
ReactDOM.render(<div> ReactDOM.render(<div>
<Button type="primary" size="large">大号按钮</Button> <Button type="primary" size="large">大号按钮</Button>

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Button = antd.Button; import { Button } from 'antd';
ReactDOM.render(<div> ReactDOM.render(<div>
<h4>使用 `disabled` 属性</h4> <h4>使用 `disabled` 属性</h4>

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Carousel = antd.Carousel; import { Carousel } from 'antd';
ReactDOM.render( ReactDOM.render(
<Carousel autoplay="true"> <Carousel autoplay="true">

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Carousel = antd.Carousel; import { Carousel } from 'antd';
ReactDOM.render( ReactDOM.render(
<Carousel> <Carousel>

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Carousel = antd.Carousel; import { Carousel } from 'antd';
ReactDOM.render( ReactDOM.render(
<Carousel effect="fade"> <Carousel effect="fade">

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Carousel = antd.Carousel; import { Carousel } from 'antd';
ReactDOM.render( ReactDOM.render(
<Carousel vertical="true"> <Carousel vertical="true">

View File

@ -7,8 +7,9 @@
--- ---
````jsx ````jsx
var Checkbox = antd.Checkbox; import { Checkbox } from 'antd';
var container = document.getElementById('components-checkbox-demo-basic'); const container = document.getElementById('components-checkbox-demo-basic');
function onChange(e) { function onChange(e) {
console.log('checked = ' + e.target.checked); console.log('checked = ' + e.target.checked);
} }

View File

@ -7,16 +7,15 @@
--- ---
````jsx ````jsx
var Checkbox = antd.Checkbox; import { Checkbox, Button } from 'antd';
var Button = antd.Button; const container = document.getElementById('components-checkbox-demo-controller');
var container = document.getElementById('components-checkbox-demo-controller');
var App = React.createClass({ const App = React.createClass({
getInitialState() { getInitialState() {
return { return {
checked: true, checked: true,
disabled: false disabled: false
} };
}, },
render() { render() {
var label = (this.state.checked ? '选中' : '取消') + '-' + var label = (this.state.checked ? '选中' : '取消') + '-' +

View File

@ -7,8 +7,8 @@ checkbox 不可用。
--- ---
````jsx ````jsx
var Checkbox = antd.Checkbox; import { Checkbox } from 'antd';
var container = document.getElementById('components-checkbox-demo-disable'); const container = document.getElementById('components-checkbox-demo-disable');
ReactDOM.render(<div> ReactDOM.render(<div>
<Checkbox defaultChecked={false} disabled={true}/> <Checkbox defaultChecked={false} disabled={true}/>

View File

@ -7,10 +7,10 @@
--- ---
````jsx ````jsx
var Collapse = antd.Collapse; import { Collapse } from 'antd';
var Panel = Collapse.Panel; const Panel = Collapse.Panel;
var text = ` const text = `
A dog is a type of domesticated animal. A dog is a type of domesticated animal.
Known for its loyalty and faithfulness, Known for its loyalty and faithfulness,
it can be found as a welcome guest in many households across the world. it can be found as a welcome guest in many households across the world.

View File

@ -7,14 +7,14 @@
--- ---
````jsx ````jsx
var Collapse = antd.Collapse; import { Collapse } from 'antd';
var Panel = Collapse.Panel; const Panel = Collapse.Panel;
function callback(key) { function callback(key) {
console.log(key); console.log(key);
} }
var text = ` const text = `
A dog is a type of domesticated animal. A dog is a type of domesticated animal.
Known for its loyalty and faithfulness, Known for its loyalty and faithfulness,
it can be found as a welcome guest in many households across the world. it can be found as a welcome guest in many households across the world.

View File

@ -7,14 +7,14 @@
--- ---
````jsx ````jsx
var Collapse = antd.Collapse; import { Collapse } from 'antd';
var Panel = Collapse.Panel; const Panel = Collapse.Panel;
function callback(key) { function callback(key) {
console.log(key); console.log(key);
} }
var text = ` const text = `
A dog is a type of domesticated animal. A dog is a type of domesticated animal.
Known for its loyalty and faithfulness, Known for its loyalty and faithfulness,
it can be found as a welcome guest in many households across the world. it can be found as a welcome guest in many households across the world.

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Datepicker = antd.Datepicker; import { Datepicker } from 'antd';
ReactDOM.render( ReactDOM.render(
<Datepicker defaultValue="2015-12-12" /> <Datepicker defaultValue="2015-12-12" />

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Datepicker = antd.Datepicker; import { Datepicker } from 'antd';
ReactDOM.render( ReactDOM.render(
<Datepicker defaultValue="2015-06-06" disabled={true} /> <Datepicker defaultValue="2015-06-06" disabled={true} />

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Datepicker = antd.Datepicker; import { Datepicker } from 'antd';
ReactDOM.render( ReactDOM.render(
<Datepicker defaultValue="2015/01/01" format="yyyy/MM/dd" /> <Datepicker defaultValue="2015/01/01" format="yyyy/MM/dd" />

View File

@ -7,9 +7,9 @@
--- ---
````jsx ````jsx
var Datepicker = antd.Datepicker; import { Datepicker } from 'antd';
var App = React.createClass({ const App = React.createClass({
getInitialState() { getInitialState() {
return { return {
locale: { locale: {

View File

@ -9,8 +9,9 @@
--- ---
````jsx ````jsx
var Datepicker = antd.Datepicker; import { Datepicker } from 'antd';
var disabledDate = function(current, value) {
const disabledDate = function(current, value) {
// can not select days after today // can not select days after today
return current.getTime() > Date.now(); return current.getTime() > Date.now();
}; };

View File

@ -7,9 +7,9 @@
--- ---
````jsx ````jsx
var Datepicker = antd.Datepicker; import { Datepicker } from 'antd';
var Picker = React.createClass({ const Picker = React.createClass({
handleChange: function(value) { handleChange: function(value) {
console.log(new Date(value.getTime())); console.log(new Date(value.getTime()));
}, },

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Datepicker = antd.Datepicker; import { Datepicker } from 'antd';
ReactDOM.render( ReactDOM.render(
<div> <div>

View File

@ -7,9 +7,9 @@
--- ---
````jsx ````jsx
var Datepicker = antd.Datepicker; import { Datepicker } from 'antd';
var DateRange = React.createClass({ const DateRange = React.createClass({
getInitialState() { getInitialState() {
return { return {
startValue: null, startValue: null,

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Datepicker = antd.Datepicker; import { Datepicker } from 'antd';
ReactDOM.render( ReactDOM.render(
<Datepicker showTime={true} format="yyyy-MM-dd HH:mm:ss" /> <Datepicker showTime={true} format="yyyy-MM-dd HH:mm:ss" />

View File

@ -7,12 +7,9 @@
--- ---
````jsx ````jsx
var Menu = antd.Menu; import { Menu, Dropdown, Button, Icon } from 'antd';
var Dropdown = antd.Dropdown;
var Button = antd.Button;
var Icon = antd.Icon;
var menu = <Menu> const menu = <Menu>
<Menu.Item> <Menu.Item>
<a target="_blank" href="http://www.alipay.com/">第一个菜单项</a> <a target="_blank" href="http://www.alipay.com/">第一个菜单项</a>
</Menu.Item> </Menu.Item>

View File

@ -7,15 +7,12 @@
--- ---
````jsx ````jsx
var Menu = antd.Menu; import { Menu, Dropdown, Button, Icon } from 'antd';
var Dropdown = antd.Dropdown; const onSelect = function ({key}){
var Button = antd.Button;
var Icon = antd.Icon;
var onSelect = function ({key}){
alert('选中了菜单' + key); alert('选中了菜单' + key);
}; };
var menu = <Menu onSelect={onSelect}> const menu = <Menu onSelect={onSelect}>
<Menu.Item key="1">第一个菜单项</Menu.Item> <Menu.Item key="1">第一个菜单项</Menu.Item>
<Menu.Item key="2">第二个菜单项</Menu.Item> <Menu.Item key="2">第二个菜单项</Menu.Item>
<Menu.Item key="3">第三个菜单项</Menu.Item> <Menu.Item key="3">第三个菜单项</Menu.Item>

View File

@ -7,12 +7,9 @@
--- ---
````jsx ````jsx
var Menu = antd.Menu; import { Menu, Dropdown, Button, Icon } from 'antd';
var Dropdown = antd.Dropdown;
var Button = antd.Button;
var Icon = antd.Icon;
var menu = <Menu> const menu = <Menu>
<Menu.Item key="0"> <Menu.Item key="0">
<a target="_blank" href="http://www.alipay.com/">第一个菜单项</a> <a target="_blank" href="http://www.alipay.com/">第一个菜单项</a>
</Menu.Item> </Menu.Item>

View File

@ -7,12 +7,9 @@
--- ---
````jsx ````jsx
var Menu = antd.Menu; import { Menu, Dropdown, Button, Icon } from 'antd';
var Dropdown = antd.Dropdown;
var Button = antd.Button;
var Icon = antd.Icon;
var menu = <Menu> const menu = <Menu>
<Menu.Item key="0"> <Menu.Item key="0">
<a href="http://www.alipay.com/">第一个菜单项</a> <a href="http://www.alipay.com/">第一个菜单项</a>
</Menu.Item> </Menu.Item>

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var InputNumber = antd.InputNumber; import { InputNumber } from 'antd';
function onChange(value) { function onChange(value) {
console.log('changed', value); console.log('changed', value);

View File

@ -7,8 +7,7 @@
--- ---
````jsx ````jsx
var InputNumber = antd.InputNumber; import { InputNumber, Button } from 'antd';
var Button = antd.Button;
var Test = React.createClass({ var Test = React.createClass({
getInitialState() { getInitialState() {

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var InputNumber = antd.InputNumber; import { InputNumber } from 'antd';
function onChange(value) { function onChange(value) {
console.log('changed', value); console.log('changed', value);

View File

@ -1,6 +1,6 @@
# 基础布局 # 基础布局
- order: 1 - order: 1
从堆叠到水平排列。 从堆叠到水平排列。
@ -9,8 +9,7 @@
--- ---
````jsx ````jsx
var Row = antd.Row; import { Row, Col } from 'antd';
var Col = antd.Col;
ReactDOM.render( ReactDOM.render(
<div> <div>
@ -41,4 +40,4 @@ ReactDOM.render(
div.testColClassName { div.testColClassName {
background: rgba(24, 115, 216, 0.9); background: rgba(24, 115, 216, 0.9);
} }
</style> </style>

View File

@ -1,6 +1,6 @@
# Flex对齐 # Flex对齐
- order: 5 - order: 5
Flex 子元素垂直对齐。 Flex 子元素垂直对齐。
@ -8,8 +8,7 @@ Flex 子元素垂直对齐。
--- ---
````jsx ````jsx
var Row = antd.Row; import { Row, Col } from 'antd';
var Col = antd.Col;
var DemoBox = React.createClass({ var DemoBox = React.createClass({
render() { render() {
@ -30,7 +29,7 @@ ReactDOM.render(
<Col span="4"><DemoBox value="120">.col-4</DemoBox></Col> <Col span="4"><DemoBox value="120">.col-4</DemoBox></Col>
<Col span="4"><DemoBox value="80">.col-4</DemoBox></Col> <Col span="4"><DemoBox value="80">.col-4</DemoBox></Col>
</Row> </Row>
<p>居中对齐</p> <p>居中对齐</p>
<Row type="flex" justify="space-around" align="middle"> <Row type="flex" justify="space-around" align="middle">
<Col span="4"><DemoBox value="100">.col-4</DemoBox></Col> <Col span="4"><DemoBox value="100">.col-4</DemoBox></Col>
@ -38,7 +37,7 @@ ReactDOM.render(
<Col span="4"><DemoBox value="120">.col-4</DemoBox></Col> <Col span="4"><DemoBox value="120">.col-4</DemoBox></Col>
<Col span="4"><DemoBox value="80">.col-4</DemoBox></Col> <Col span="4"><DemoBox value="80">.col-4</DemoBox></Col>
</Row> </Row>
<p>底部对齐</p> <p>底部对齐</p>
<Row type="flex" justify="space-between" align="bottom"> <Row type="flex" justify="space-between" align="bottom">
<Col span="4"><DemoBox value="100">.col-4</DemoBox></Col> <Col span="4"><DemoBox value="100">.col-4</DemoBox></Col>
@ -50,6 +49,3 @@ ReactDOM.render(
document.getElementById('components-layout-demo-flex-align') document.getElementById('components-layout-demo-flex-align')
); );
```` ````

View File

@ -1,6 +1,6 @@
# Flex排序 # Flex排序
- order: 6 - order: 6
通过 Flex 布局的 Order 来改变元素的排序。 通过 Flex 布局的 Order 来改变元素的排序。
@ -9,8 +9,7 @@
````jsx ````jsx
var Row = antd.Row; import { Row, Col } from 'antd';
var Col = antd.Col;
ReactDOM.render( ReactDOM.render(
<div> <div>
@ -23,9 +22,4 @@ ReactDOM.render(
</div>, </div>,
document.getElementById('components-layout-demo-flex-order') document.getElementById('components-layout-demo-flex-order')
); );
```` ````

View File

@ -1,6 +1,6 @@
# Flex布局 # Flex布局
- order: 4 - order: 4
Flex 布局基础。 Flex 布局基础。
@ -9,8 +9,7 @@ Flex 布局基础。
--- ---
````jsx ````jsx
var Row = antd.Row; import { Row, Col } from 'antd';
var Col = antd.Col;
ReactDOM.render( ReactDOM.render(
<div> <div>
@ -21,7 +20,7 @@ ReactDOM.render(
<Col span="4">.col-4</Col> <Col span="4">.col-4</Col>
<Col span="4">.col-4</Col> <Col span="4">.col-4</Col>
</Row> </Row>
<p>子元素居中排列</p> <p>子元素居中排列</p>
<Row type="flex" justify="center"> <Row type="flex" justify="center">
<Col span="4">.col-4</Col> <Col span="4">.col-4</Col>

View File

@ -1,6 +1,6 @@
# 左右偏移 # 左右偏移
- order: 2 - order: 2
列偏移。 列偏移。
@ -9,8 +9,7 @@
--- ---
````jsx ````jsx
var Row = antd.Row; import { Row, Col } from 'antd';
var Col = antd.Col;
ReactDOM.render( ReactDOM.render(
<div> <div>
@ -29,4 +28,3 @@ ReactDOM.render(
document.getElementById('components-layout-demo-offset') document.getElementById('components-layout-demo-offset')
); );
```` ````

View File

@ -1,6 +1,6 @@
# 布局排序 # 布局排序
- order: 3 - order: 3
列排序。 列排序。
@ -9,8 +9,7 @@
--- ---
````jsx ````jsx
var Row = antd.Row; import { Row, Col } from 'antd';
var Col = antd.Col;
ReactDOM.render( ReactDOM.render(
<div> <div>
@ -21,4 +20,4 @@ ReactDOM.render(
</div>, </div>,
document.getElementById('components-layout-demo-sort') document.getElementById('components-layout-demo-sort')
); );
```` ````

View File

@ -7,11 +7,10 @@
--- ---
````jsx ````jsx
var Menu = antd.Menu; import { Menu, Icon } from 'antd';
var SubMenu = Menu.SubMenu; const SubMenu = Menu.SubMenu;
var Icon = antd.Icon;
var App = React.createClass({ const App = React.createClass({
getInitialState() { getInitialState() {
return { return {
current: 'mail' current: 'mail'
@ -25,22 +24,22 @@ var App = React.createClass({
}, },
render() { render() {
return <Menu onClick={this.handleClick} selectedKeys={[this.state.current]} mode="horizontal"> return <Menu onClick={this.handleClick} selectedKeys={[this.state.current]} mode="horizontal">
<Menu.Item key="mail"> <Menu.Item key="mail">
<Icon type="mail" />导航一 <Icon type="mail" />导航一
</Menu.Item> </Menu.Item>
<Menu.Item key="app"> <Menu.Item key="app">
<Icon type="appstore" />导航二 <Icon type="appstore" />导航二
</Menu.Item> </Menu.Item>
<SubMenu title={<span><Icon type="setting" />导航 - 子菜单</span>}> <SubMenu title={<span><Icon type="setting" />导航 - 子菜单</span>}>
<Menu.Item key="setting:1">选项1</Menu.Item> <Menu.Item key="setting:1">选项1</Menu.Item>
<Menu.Item key="setting:2">选项2</Menu.Item> <Menu.Item key="setting:2">选项2</Menu.Item>
<Menu.Item key="setting:3">选项3</Menu.Item> <Menu.Item key="setting:3">选项3</Menu.Item>
<Menu.Item key="setting:4">选项4</Menu.Item> <Menu.Item key="setting:4">选项4</Menu.Item>
</SubMenu> </SubMenu>
<Menu.Item key="alipay"> <Menu.Item key="alipay">
<a href="http://www.alipay.com/" target="_blank">导航四 - 链接</a> <a href="http://www.alipay.com/" target="_blank">导航四 - 链接</a>
</Menu.Item> </Menu.Item>
</Menu> </Menu>;
} }
}); });

View File

@ -7,9 +7,8 @@
--- ---
````jsx ````jsx
var Menu = antd.Menu; import { Menu, Icon } from 'antd';
var SubMenu = Menu.SubMenu; const SubMenu = Menu.SubMenu;
var Icon = antd.Icon;
var Sider = React.createClass({ var Sider = React.createClass({
getInitialState() { getInitialState() {

View File

@ -7,9 +7,8 @@
--- ---
````jsx ````jsx
var Menu = antd.Menu; import { Menu, Icon } from 'antd';
var SubMenu = Menu.SubMenu; const SubMenu = Menu.SubMenu;
var Icon = antd.Icon;
var Sider = React.createClass({ var Sider = React.createClass({
getInitialState() { getInitialState() {

View File

@ -7,10 +7,8 @@
--- ---
````jsx ````jsx
var Menu = antd.Menu; import { Menu, Icon } from 'antd';
var MenuItem = Menu.Item; const SubMenu = Menu.SubMenu;
var SubMenu = Menu.SubMenu;
var Icon = antd.Icon;
function handleClick(e) { function handleClick(e) {
console.log('click', e); console.log('click', e);
@ -18,24 +16,24 @@ function handleClick(e) {
ReactDOM.render(<Menu onClick={handleClick} style={{width:240}} mode="vertical"> ReactDOM.render(<Menu onClick={handleClick} style={{width:240}} mode="vertical">
<SubMenu key="sub1" title={<span><Icon type="mail" /><span>导航一</span></span>}> <SubMenu key="sub1" title={<span><Icon type="mail" /><span>导航一</span></span>}>
<MenuItem key="1">选项1</MenuItem> <Menu.Item key="1">选项1</Menu.Item>
<MenuItem key="2">选项2</MenuItem> <Menu.Item key="2">选项2</Menu.Item>
<MenuItem key="3">选项3</MenuItem> <Menu.Item key="3">选项3</Menu.Item>
<MenuItem key="4">选项4</MenuItem> <Menu.Item key="4">选项4</Menu.Item>
</SubMenu> </SubMenu>
<SubMenu key="sub2" title={<span><Icon type="appstore" /><span>导航二</span></span>}> <SubMenu key="sub2" title={<span><Icon type="appstore" /><span>导航二</span></span>}>
<MenuItem key="5">选项5</MenuItem> <Menu.Item key="5">选项5</Menu.Item>
<MenuItem key="6">选项6</MenuItem> <Menu.Item key="6">选项6</Menu.Item>
<SubMenu key="sub3" title="三级导航"> <SubMenu key="sub3" title="三级导航">
<MenuItem key="7">选项7</MenuItem> <Menu.Item key="7">选项7</Menu.Item>
<MenuItem key="8">选项8</MenuItem> <Menu.Item key="8">选项8</Menu.Item>
</SubMenu> </SubMenu>
</SubMenu> </SubMenu>
<SubMenu key="sub4" title={<span><icon type="setting" /><span>导航三</span></span>}> <SubMenu key="sub4" title={<span><icon type="setting" /><span>导航三</span></span>}>
<MenuItem key="9">选项9</MenuItem> <Menu.Item key="9">选项9</Menu.Item>
<MenuItem key="10">选项10</MenuItem> <Menu.Item key="10">选项10</Menu.Item>
<MenuItem key="11">选项11</MenuItem> <Menu.Item key="11">选项11</Menu.Item>
<MenuItem key="12">选项12</MenuItem> <Menu.Item key="12">选项12</Menu.Item>
</SubMenu> </SubMenu>
</Menu> </Menu>
, document.getElementById('components-menu-demo-vertical')); , document.getElementById('components-menu-demo-vertical'));

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var Button = antd.Button; import { message, Button } from 'antd';
var message = antd.message; const success = function() {
var success = function() {
message.success('这是一条成功的提示,并将于10秒后消失', 10); message.success('这是一条成功的提示,并将于10秒后消失', 10);
}; };

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var Button = antd.Button; import { message, Button } from 'antd';
var message = antd.message; const error = function() {
var error = function() {
message.error('这是一条失败的提示这是一条失败的提示这是一条失败的提示'); message.error('这是一条失败的提示这是一条失败的提示这是一条失败的提示');
}; };

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var Button = antd.Button; import { message, Button } from 'antd';
var message = antd.message; const info = function() {
var info = function() {
message.info('这是一条普通的提醒'); message.info('这是一条普通的提醒');
}; };

View File

@ -7,11 +7,10 @@
--- ---
````jsx ````jsx
var Button = antd.Button; import { message, Button } from 'antd';
var message = antd.message; const success = function() {
var success = function() { let hide = message.loading('正在执行中...', 0);
var hide = message.loading('正在执行中...', 0);
// 异步手动移除 // 异步手动移除
setTimeout(hide, 2500); setTimeout(hide, 2500);
}; };

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var Button = antd.Button; import { message, Button } from 'antd';
var message = antd.message; const success = function() {
var success = function() {
message.success('这是一条成功的提示'); message.success('这是一条成功的提示');
}; };

View File

@ -7,12 +7,11 @@
--- ---
````jsx ````jsx
var Modal = antd.Modal; import { Modal, Button } from 'antd';
var Button = antd.Button;
var ModalText = '对话框的内容'; const ModalText = '对话框的内容';
var Test = React.createClass({ const Test = React.createClass({
getInitialState() { getInitialState() {
return { return {
ModalText: '对话框的内容', ModalText: '对话框的内容',

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var Modal = antd.Modal; import { Modal, Button } from 'antd';
var Button = antd.Button;
var App = React.createClass({ const App = React.createClass({
getInitialState() { getInitialState() {
return { visible: false }; return { visible: false };
}, },

View File

@ -7,8 +7,8 @@
--- ---
````jsx ````jsx
var confirm = antd.Modal.confirm; import { Modal, Button } from 'antd';
var Button = antd.Button; const confirm = antd.Modal.confirm;
function showConfirm(){ function showConfirm(){
confirm({ confirm({

View File

@ -7,8 +7,8 @@
--- ---
````jsx ````jsx
var confirm = antd.Modal.confirm; import { Modal, Button } from 'antd';
var Button = antd.Button; const confirm = antd.Modal.confirm;
function showConfirm(){ function showConfirm(){
confirm({ confirm({

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var Modal = antd.Modal; import { Modal, Button } from 'antd';
var Button = antd.Button;
var Test = React.createClass({ const Test = React.createClass({
getInitialState: function() { getInitialState: function() {
return { return {
loading: false, loading: false,

View File

@ -7,8 +7,7 @@
--- ---
````jsx ````jsx
var Modal = antd.Modal; import { Modal, Button } from 'antd';
var Button = antd.Button;
function info() { function info() {
Modal.info({ Modal.info({

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var notification = antd.Notification; import { Button, notification } from 'antd';
var Button = antd.Button;
var openNotification = function() { const openNotification = function() {
notification.open({ notification.open({
message: "这是标题", message: "这是标题",
description: "这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案" description: "这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案"
@ -18,8 +17,6 @@ var openNotification = function() {
}; };
ReactDOM.render( ReactDOM.render(
<div> <Button type="primary" onClick={openNotification}>打开通知提醒框</Button>
<Button type="primary" onClick={openNotification}>打开通知提醒框</Button> ,document.getElementById('components-notification-demo-basic'));
</div>,
document.getElementById('components-notification-demo-basic'));
```` ````

View File

@ -7,11 +7,10 @@
--- ---
````jsx ````jsx
var notification = antd.Notification; import { Button, notification } from 'antd';
var Button = antd.Button;
var openNotification = function() { const openNotification = function() {
var args = { const args = {
message: "这是标题", message: "这是标题",
description: "这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案", description: "这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案",
duration: 10 duration: 10

View File

@ -7,15 +7,14 @@
--- ---
````jsx ````jsx
var notification = antd.Notification; import { Button, notification } from 'antd';
var Button = antd.Button;
var close = function() { const close = function() {
console.log("我被默认的关闭按钮关闭了!"); console.log("我被默认的关闭按钮关闭了!");
}; };
var openNotification = function() { const openNotification = function() {
var args = { const args = {
message: "这是标题", message: "这是标题",
description: "这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案", description: "这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案",
onClose: close onClose: close

View File

@ -7,20 +7,19 @@
--- ---
````jsx ````jsx
var notification = antd.Notification; import { Button, notification } from 'antd';
var Button = antd.Button;
var close = function(){ const close = function(){
console.log('我被默认的关闭按钮关闭了!'); console.log('我被默认的关闭按钮关闭了!');
} }
var openNotification = function() { const openNotification = function() {
var key='open'+Date.now(); const key='open'+Date.now();
var btnClick = function() { const btnClick = function() {
// 隐藏提醒框 // 隐藏提醒框
notification.close(key); notification.close(key);
}; };
var btn = <Button type="primary" size="small" onClick={btnClick}> const btn = <Button type="primary" size="small" onClick={btnClick}>
自定义关闭按钮并触发回调函数 自定义关闭按钮并触发回调函数
</Button>; </Button>;
notification.open({ notification.open({

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var notification = antd.Notification; import { Button, notification } from 'antd';
var Button = antd.Button;
var openNotificationWithIcon = function(type) { const openNotificationWithIcon = function(type) {
return function(){ return function(){
notification[type]({ notification[type]({
message: "这是标题", message: "这是标题",

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Pagination = antd.Pagination; import { Pagination } from 'antd';
function onChange(page) { function onChange(page) {
console.log(page); console.log(page);

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Pagination = antd.Pagination; import { Pagination } from 'antd';
function onChange(page) { function onChange(page) {
console.log(page); console.log(page);

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Pagination = antd.Pagination; import { Pagination } from 'antd';
function onChange(page) { function onChange(page) {
console.log(page); console.log(page);

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Pagination = antd.Pagination; import { Pagination } from 'antd';
function onChange(page) { function onChange(page) {
console.log(page); console.log(page);

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Pagination = antd.Pagination; import { Pagination } from 'antd';
function onChange(page) { function onChange(page) {
console.log(page); console.log(page);

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Pagination = antd.Pagination; import { Pagination } from 'antd';
function onChange(page) { function onChange(page) {
console.log(page); console.log(page);

View File

@ -7,8 +7,7 @@
--- ---
````jsx ````jsx
var Popconfirm = antd.Popconfirm; import { Popconfirm, message } from 'antd';
var message = antd.message;
function confirm() { function confirm() {
message.success('点击了确定'); message.success('点击了确定');

View File

@ -7,9 +7,9 @@
--- ---
````jsx ````jsx
var Popconfirm = antd.Popconfirm; import { Popconfirm, message } from 'antd';
var message = antd.message;
var text = '确定要删除这个任务吗?'; const text = '确定要删除这个任务吗?';
function confirm() { function confirm() {
message.info('点击了确定'); message.info('点击了确定');

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var Popover = antd.Popover; import { Popover, Button } from 'antd';
var Button = antd.Button;
var content = <div> const content = <div>
<p>内容</p> <p>内容</p>
<p>内容</p> <p>内容</p>
</div>; </div>;

View File

@ -7,11 +7,10 @@
--- ---
````jsx ````jsx
var Popover = antd.Popover; import { Popover, Button } from 'antd';
var Button = antd.Button;
var text = <span>标题</span>; const text = <span>标题</span>;
var content = <div> const content = <div>
<p>内容</p> <p>内容</p>
<p>内容</p> <p>内容</p>
</div>; </div>;

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var Popover = antd.Popover; import { Popover, Button } from 'antd';
var Button = antd.Button;
var content = <div> const content = <div>
<p>内容</p> <p>内容</p>
<p>内容</p> <p>内容</p>
</div>; </div>;

View File

@ -7,12 +7,10 @@
--- ---
````jsx ````jsx
var ProgressCircle = antd.Progress.Circle; import { Progress, Button, ButtonGroup, Icon } from 'antd';
var Button = antd.Button; const ProgressCircle = Progress.Circle;
var ButtonGroup = antd.ButtonGroup;
var Icon = antd.Icon;
var MyProgress = React.createClass({ const MyProgress = React.createClass({
getInitialState() { getInitialState() {
return { return {
percent: 0 percent: 0

View File

@ -7,7 +7,8 @@
--- ---
````jsx ````jsx
var ProgressCircle = antd.Progress.Circle; import { Progress } from 'antd';
const ProgressCircle = Progress.Circle;
ReactDOM.render( ReactDOM.render(
<div> <div>

View File

@ -7,7 +7,8 @@
--- ---
````jsx ````jsx
var ProgressCircle = antd.Progress.Circle; import { Progress } from 'antd';
const ProgressCircle = Progress.Circle;
ReactDOM.render( ReactDOM.render(
<div> <div>

View File

@ -7,12 +7,10 @@
--- ---
````jsx ````jsx
var Progress = antd.Progress.Line; import { Progress, Button, ButtonGroup, Icon } from 'antd';
var Button = antd.Button; const ProgressLine = Progress.Line;
var ButtonGroup = antd.ButtonGroup;
var Icon = antd.Icon;
var MyProgress = React.createClass({ const MyProgress = React.createClass({
getInitialState() { getInitialState() {
return { return {
percent: 0 percent: 0
@ -34,7 +32,7 @@ var MyProgress = React.createClass({
}, },
render() { render() {
return <div> return <div>
<Progress percent={this.state.percent} /> <ProgressLine percent={this.state.percent} />
<ButtonGroup> <ButtonGroup>
<Button type="ghost" onClick={this.decline}> <Button type="ghost" onClick={this.decline}>
<Icon type="minus" /> <Icon type="minus" />

View File

@ -7,14 +7,15 @@
--- ---
````jsx ````jsx
var Progress = antd.Progress.Line; import { Progress } from 'antd';
const ProgressLine = Progress.Line;
ReactDOM.render( ReactDOM.render(
<div style={{ width: 170 }}> <div style={{ width: 170 }}>
<Progress percent={30} strokeWidth={5} /> <ProgressLine percent={30} strokeWidth={5} />
<Progress percent={50} strokeWidth={5} status="active" /> <ProgressLine percent={50} strokeWidth={5} status="active" />
<Progress percent={70} strokeWidth={5} status="exception" /> <ProgressLine percent={70} strokeWidth={5} status="exception" />
<Progress percent={100} strokeWidth={5} /> <ProgressLine percent={100} strokeWidth={5} />
</div> </div>
, document.getElementById('components-progress-demo-line-mini')); , document.getElementById('components-progress-demo-line-mini'));
```` ````

View File

@ -7,15 +7,16 @@
--- ---
````jsx ````jsx
var Progress = antd.Progress.Line; import { Progress } from 'antd';
const ProgressLine = Progress.Line;
ReactDOM.render( ReactDOM.render(
<div> <div>
<Progress percent={30} /> <ProgressLine percent={30} />
<Progress percent={50} status="active" /> <ProgressLine percent={50} status="active" />
<Progress percent={70} status="exception" /> <ProgressLine percent={70} status="exception" />
<Progress percent={100} /> <ProgressLine percent={100} />
<Progress percent={50} showInfo={false} /> <ProgressLine percent={50} showInfo={false} />
</div> </div>
, document.getElementById('components-progress-demo-line')); , document.getElementById('components-progress-demo-line'));
```` ````

View File

@ -17,7 +17,7 @@
## API ## API
## Progress Bar ## Progress Line
| 参数 | 说明 | 类型 | 默认值 | | 参数 | 说明 | 类型 | 默认值 |
|----------|---------------|----------|-------------| |----------|---------------|----------|-------------|

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var QueueAnim = antd.QueueAnim; import { QueueAnim, Button } from 'antd';
var Button = antd.Button;
var Test = React.createClass({ const Test = React.createClass({
getInitialState() { getInitialState() {
return { return {
show: true show: true

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var QueueAnim = antd.QueueAnim; import { QueueAnim, Button } from 'antd';
var Button = antd.Button;
var Test = React.createClass({ const Test = React.createClass({
getInitialState() { getInitialState() {
return { return {
show: true, show: true,
@ -27,7 +26,7 @@ var Test = React.createClass({
}); });
}, },
onAdd() { onAdd() {
var items = this.state.items; let items = this.state.items;
items.push(<li key={Date.now()}></li>); items.push(<li key={Date.now()}></li>);
this.setState({ this.setState({
show: true, show: true,
@ -35,7 +34,7 @@ var Test = React.createClass({
}); });
}, },
onRemove() { onRemove() {
var items = this.state.items; let items = this.state.items;
items.splice(items.length - 1, 1); items.splice(items.length - 1, 1);
this.setState({ this.setState({
show: true, show: true,

View File

@ -7,9 +7,9 @@
--- ---
````jsx ````jsx
var QueueAnim = antd.QueueAnim; import { QueueAnim, Button } from 'antd';
var Button = antd.Button;
var Test = React.createClass({ const Test = React.createClass({
getInitialState() { getInitialState() {
return { return {
show: true, show: true,

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var QueueAnim = antd.QueueAnim; import { QueueAnim, Button } from 'antd';
var Button = antd.Button;
var Test = React.createClass({ const Test = React.createClass({
getInitialState() { getInitialState() {
return { return {
show: true show: true

View File

@ -7,15 +7,11 @@
--- ---
````jsx ````jsx
var QueueAnim = antd.QueueAnim; import { QueueAnim, Button, Select, Checkbox, Radio } from 'antd';
var Select = antd.Select; const Option = Select.Option;
var Option = Select.Option; const RadioGroup = Radio.Group;
var Checkbox = antd.Checkbox;
var Radio = antd.Radio;
var RadioGroup = antd.Radio.Group;
var Button = antd.Button;
var Test = React.createClass({ const Test = React.createClass({
getInitialState() { getInitialState() {
return { return {
show: true show: true

View File

@ -7,10 +7,9 @@
--- ---
````jsx ````jsx
var QueueAnim = antd.QueueAnim; import { QueueAnim, Button } from 'antd';
var Button = antd.Button;
var Test = React.createClass({ const Test = React.createClass({
getInitialState() { getInitialState() {
return { return {
show: true show: true

View File

@ -7,17 +7,14 @@ router 组合的进场与出场动画。
--- ---
````jsx ````jsx
var ReactRouter = require('react-router'); const ReactRouter = require('react-router');
var Router = ReactRouter.Router; let { Router, Route, Link } = ReactRouter;
var Route = ReactRouter.Route; import { QueueAnim, Menu } from 'antd';
var Link = ReactRouter.Link;
var QueueAnim = antd.QueueAnim;
var Menu = antd.Menu;
var App = React.createClass({ const App = React.createClass({
render() { render() {
var key = this.props.location.pathname; const key = this.props.location.pathname;
var keys = key.replace('/', '') ? [ key.replace('/', '') ] : [ 'home' ]; const keys = key.replace('/', '') ? [ key.replace('/', '') ] : [ 'home' ];
return ( return (
<div> <div>
<Menu style={{marginBottom: 10}} mode="horizontal" selectedKeys={keys}> <Menu style={{marginBottom: 10}} mode="horizontal" selectedKeys={keys}>
@ -39,7 +36,7 @@ var App = React.createClass({
} }
}); });
var Home = React.createClass({ const Home = React.createClass({
render() { render() {
return ( return (
<div className="demo-router-child"> <div className="demo-router-child">
@ -71,7 +68,7 @@ var Home = React.createClass({
} }
}); });
var Page1 = React.createClass({ const Page1 = React.createClass({
render() { render() {
return ( return (
<div className="demo-router-child"> <div className="demo-router-child">
@ -99,7 +96,7 @@ var Page1 = React.createClass({
} }
}); });
var Page2 = React.createClass({ const Page2 = React.createClass({
render() { render() {
return ( return (
<div className="demo-router-child"> <div className="demo-router-child">

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var QueueAnim = antd.QueueAnim; import { QueueAnim } from 'antd';
ReactDOM.render( ReactDOM.render(
<QueueAnim delay={500}> <QueueAnim delay={500}>

View File

@ -7,7 +7,7 @@
--- ---
````jsx ````jsx
var Radio = antd.Radio; import { Radio } from 'antd';
ReactDOM.render(<Radio>Radio</Radio> ReactDOM.render(<Radio>Radio</Radio>
, document.getElementById('components-radio-demo-basic')); , document.getElementById('components-radio-demo-basic'));

Some files were not shown because too many files have changed in this diff Show More