mirror of
https://github.com/ant-design/ant-design.git
synced 2025-06-11 03:22:59 +08:00
Fix markdown eslint errors, update .eslintrc
This commit is contained in:
parent
efbd455384
commit
16abf46071
@ -12,6 +12,7 @@
|
|||||||
"experimentalObjectRestSpread": true
|
"experimentalObjectRestSpread": true
|
||||||
},
|
},
|
||||||
"plugins": [
|
"plugins": [
|
||||||
|
"markdown",
|
||||||
"react",
|
"react",
|
||||||
"babel"
|
"babel"
|
||||||
],
|
],
|
||||||
@ -32,7 +33,6 @@
|
|||||||
"babel/object-shorthand": 0,
|
"babel/object-shorthand": 0,
|
||||||
"react/jsx-boolean-value": 0,
|
"react/jsx-boolean-value": 0,
|
||||||
"react/jsx-no-duplicate-props": 2,
|
"react/jsx-no-duplicate-props": 2,
|
||||||
"react/prop-types": [2, { "ignore": [ "children", "className", "style" ] }],
|
|
||||||
"react/sort-comp": 0,
|
"react/sort-comp": 0,
|
||||||
"react/wrap-multilines": 0,
|
"react/wrap-multilines": 0,
|
||||||
"react/no-multi-comp": 0,
|
"react/no-multi-comp": 0,
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
````jsx
|
````jsx
|
||||||
import { Alert } from 'antd';
|
import { Alert } from 'antd';
|
||||||
const link = <a href="javascript:;">不再提醒</a>;
|
const link = <a href="#">不再提醒</a>;
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Alert message="消息提示的文案" type="info" closeText={link} />
|
<Alert message="消息提示的文案" type="info" closeText={link} />
|
||||||
|
@ -16,6 +16,7 @@ export default React.createClass({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
handleClose(e) {
|
handleClose(e) {
|
||||||
|
e.preventDefault();
|
||||||
let dom = ReactDOM.findDOMNode(this);
|
let dom = ReactDOM.findDOMNode(this);
|
||||||
dom.style.height = dom.offsetHeight + 'px';
|
dom.style.height = dom.offsetHeight + 'px';
|
||||||
// Magic code
|
// Magic code
|
||||||
|
@ -18,7 +18,7 @@ ReactDOM.render(<div>
|
|||||||
<Button>次按钮</Button>
|
<Button>次按钮</Button>
|
||||||
<Button type="ghost">幽灵按钮</Button>
|
<Button type="ghost">幽灵按钮</Button>
|
||||||
</div>,
|
</div>,
|
||||||
document.getElementById('components-button-demo-basic'))
|
document.getElementById('components-button-demo-basic'));
|
||||||
````
|
````
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
import { Calendar } from 'antd';
|
import { Calendar } from 'antd';
|
||||||
|
|
||||||
function getListData(value) {
|
function getListData(value) {
|
||||||
var listData;
|
let listData;
|
||||||
switch (value.getDayOfMonth()) {
|
switch (value.getDayOfMonth()) {
|
||||||
case 8:
|
case 8:
|
||||||
listData = [
|
listData = [
|
||||||
@ -32,6 +32,7 @@ function getListData(value) {
|
|||||||
{ type: 'error', content: '这里是错误事项.' },
|
{ type: 'error', content: '这里是错误事项.' },
|
||||||
{ type: 'error', content: '这里是错误事项.' }
|
{ type: 'error', content: '这里是错误事项.' }
|
||||||
]; break;
|
]; break;
|
||||||
|
default:
|
||||||
}
|
}
|
||||||
return listData || [];
|
return listData || [];
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,7 @@ const App = React.createClass({
|
|||||||
};
|
};
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
var label = (this.state.checked ? '选中' : '取消') + '-' +
|
const label = (this.state.checked ? '选中' : '取消') + '-' +
|
||||||
(this.state.disabled ? '不可用' : '可用');
|
(this.state.disabled ? '不可用' : '可用');
|
||||||
return <div>
|
return <div>
|
||||||
<p style={{marginBottom: '20px'}}>
|
<p style={{marginBottom: '20px'}}>
|
||||||
@ -32,12 +32,12 @@ const App = React.createClass({
|
|||||||
<p>
|
<p>
|
||||||
<Button type="primary" size="small"
|
<Button type="primary" size="small"
|
||||||
onClick={this.toggleChecked}>
|
onClick={this.toggleChecked}>
|
||||||
{!this.state.checked ? "选中":"取消"}
|
{!this.state.checked ? '选中' : '取消'}
|
||||||
</Button>
|
</Button>
|
||||||
<Button style={{'marginLeft': '10px'}}
|
<Button style={{marginLeft: '10px'}}
|
||||||
type="primary" size="small"
|
type="primary" size="small"
|
||||||
onClick={this.toggleDisable}>
|
onClick={this.toggleDisable}>
|
||||||
{!this.state.disabled ? "不可用":"可用"}
|
{!this.state.disabled ? '不可用' : '可用'}
|
||||||
</Button>
|
</Button>
|
||||||
</p>
|
</p>
|
||||||
</div>;
|
</div>;
|
||||||
|
@ -21,14 +21,14 @@ const text = `
|
|||||||
`;
|
`;
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Collapse defaultActiveKey={["1"]} onChange={callback}>
|
<Collapse defaultActiveKey={['1']} onChange={callback}>
|
||||||
<Panel header={`This is panel header 1`} key="1">
|
<Panel header="This is panel header 1" key="1">
|
||||||
<p>{text}</p>
|
<p>{text}</p>
|
||||||
</Panel>
|
</Panel>
|
||||||
<Panel header={`This is panel header 2`} key="2">
|
<Panel header="This is panel header 2" key="2">
|
||||||
<p>{text}</p>
|
<p>{text}</p>
|
||||||
</Panel>
|
</Panel>
|
||||||
<Panel header={`This is panel header 3`} key="3">
|
<Panel header="This is panel header 3" key="3">
|
||||||
<p>{text}</p>
|
<p>{text}</p>
|
||||||
</Panel>
|
</Panel>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
````jsx
|
````jsx
|
||||||
import { Datepicker } from 'antd';
|
import { Datepicker } from 'antd';
|
||||||
import enUS from 'antd/lib/datepicker/locale/en_US';
|
import enUS from 'antd/lib/datepicker/locale/en_US';
|
||||||
import assign from 'object-assign'
|
import assign from 'object-assign';
|
||||||
|
|
||||||
const App = React.createClass({
|
const App = React.createClass({
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
|
@ -14,7 +14,7 @@ const Picker = React.createClass({
|
|||||||
console.log(new Date(value.getTime()));
|
console.log(new Date(value.getTime()));
|
||||||
},
|
},
|
||||||
render: function() {
|
render: function() {
|
||||||
return <Datepicker onChange={this.handleChange} />
|
return <Datepicker onChange={this.handleChange} />;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -29,7 +29,7 @@ const DateRange = React.createClass({
|
|||||||
return endValue.getTime() <= this.state.startValue.getTime();
|
return endValue.getTime() <= this.state.startValue.getTime();
|
||||||
},
|
},
|
||||||
onChange(field, value) {
|
onChange(field, value) {
|
||||||
console.log(field,'change',value);
|
console.log(field, 'change', value);
|
||||||
this.setState({
|
this.setState({
|
||||||
[field]: value,
|
[field]: value,
|
||||||
});
|
});
|
||||||
@ -39,11 +39,11 @@ const DateRange = React.createClass({
|
|||||||
<Datepicker disabledDate={this.disabledStartDate}
|
<Datepicker disabledDate={this.disabledStartDate}
|
||||||
value={this.state.startValue}
|
value={this.state.startValue}
|
||||||
placeholder="开始日期"
|
placeholder="开始日期"
|
||||||
onChange={this.onChange.bind(this,'startValue')} />
|
onChange={this.onChange.bind(this, 'startValue')} />
|
||||||
<Datepicker disabledDate={this.disabledEndDate}
|
<Datepicker disabledDate={this.disabledEndDate}
|
||||||
value={this.state.endValue}
|
value={this.state.endValue}
|
||||||
placeholder="结束日期"
|
placeholder="结束日期"
|
||||||
onChange={this.onChange.bind(this,'endValue')} />
|
onChange={this.onChange.bind(this, 'endValue')} />
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -13,8 +13,11 @@ let result = new Date();
|
|||||||
let selectdDate, selectdTime;
|
let selectdDate, selectdTime;
|
||||||
function handleChange(from, value) {
|
function handleChange(from, value) {
|
||||||
if (!value) {
|
if (!value) {
|
||||||
from === 'date' ?
|
if (from === 'date') {
|
||||||
(selectdDate = false) : (selectdTime = false);
|
selectdDate = false;
|
||||||
|
} else {
|
||||||
|
selectdTime = false;
|
||||||
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (from === 'date') {
|
if (from === 'date') {
|
||||||
|
@ -21,7 +21,7 @@ const menu = <Menu>
|
|||||||
</Menu>;
|
</Menu>;
|
||||||
|
|
||||||
ReactDOM.render(<div>
|
ReactDOM.render(<div>
|
||||||
<Dropdown overlay={menu} trigger={["click"]}>
|
<Dropdown overlay={menu} trigger={['click']}>
|
||||||
<Button type="primary">
|
<Button type="primary">
|
||||||
点击触发 <Icon type="down" />
|
点击触发 <Icon type="down" />
|
||||||
</Button>
|
</Button>
|
||||||
|
@ -30,7 +30,7 @@ const Demo = React.createClass({
|
|||||||
|
|
||||||
handleSubmit(e) {
|
handleSubmit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
message.success("收到表单值~~~ :" + JSON.stringify(this.state.formData, function(k, v) {
|
message.success('收到表单值~~~ :' + JSON.stringify(this.state.formData, function(k, v) {
|
||||||
if (typeof v === 'undefined') {
|
if (typeof v === 'undefined') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -62,7 +62,7 @@ const Demo = React.createClass({
|
|||||||
labelCol={{span: 6}}
|
labelCol={{span: 6}}
|
||||||
wrapperCol={{span: 14}}
|
wrapperCol={{span: 14}}
|
||||||
required={true} >
|
required={true} >
|
||||||
<RadioGroup value="male" name="gender" value={formData.gender} onChange={this.setValue.bind(this, 'gender')} >
|
<RadioGroup name="gender" value={formData.gender} onChange={this.setValue.bind(this, 'gender')} >
|
||||||
<Radio value="male">男的</Radio>
|
<Radio value="male">男的</Radio>
|
||||||
<Radio value="female">女的</Radio>
|
<Radio value="female">女的</Radio>
|
||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
|
@ -25,7 +25,7 @@ const Demo = React.createClass({
|
|||||||
|
|
||||||
handleSubmit(e) {
|
handleSubmit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
message.success("收到表单值~~~ :" + JSON.stringify(this.state.formData, function(k, v) {
|
message.success('收到表单值~~~ :' + JSON.stringify(this.state.formData, function(k, v) {
|
||||||
if (typeof v === 'undefined') {
|
if (typeof v === 'undefined') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
@ -7,18 +7,18 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
````jsx
|
````jsx
|
||||||
import {Form, Input, Select, InputNumber, Datepicker, Switch, Menu, Dropdown, Slider, Icon, Button, message, Row, Col} from 'antd';
|
import { Form, Select, InputNumber, Datepicker, Switch, Slider, Button, message, Row, Col } from 'antd';
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
const Option = Select.Option;
|
const Option = Select.Option;
|
||||||
|
|
||||||
var Demo = React.createClass({
|
const Demo = React.createClass({
|
||||||
mixins: [Form.ValueMixin],
|
mixins: [Form.ValueMixin],
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
formData: {
|
formData: {
|
||||||
inputNumber: undefined,
|
inputNumber: undefined,
|
||||||
static: "唧唧复唧唧木兰当户织呀",
|
static: '唧唧复唧唧木兰当户织呀',
|
||||||
switch: undefined,
|
switch: undefined,
|
||||||
slider: undefined,
|
slider: undefined,
|
||||||
select: undefined,
|
select: undefined,
|
||||||
@ -30,7 +30,7 @@ var Demo = React.createClass({
|
|||||||
|
|
||||||
handleSubmit(e) {
|
handleSubmit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
message.success("收到表单值~~~ :" + JSON.stringify(this.state.formData, function(k, v) {
|
message.success('收到表单值~~~ :' + JSON.stringify(this.state.formData, function(k, v) {
|
||||||
if (typeof v === 'undefined') {
|
if (typeof v === 'undefined') {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
@ -39,7 +39,7 @@ var Demo = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
var formData = this.state.formData;
|
const formData = this.state.formData;
|
||||||
return (
|
return (
|
||||||
<Form horizontal onSubmit={this.handleSubmit} >
|
<Form horizontal onSubmit={this.handleSubmit} >
|
||||||
<FormItem
|
<FormItem
|
||||||
@ -58,7 +58,7 @@ var Demo = React.createClass({
|
|||||||
required={true} >
|
required={true} >
|
||||||
<p className="ant-form-text" id="static" name="static">唧唧复唧唧木兰当户织呀</p>
|
<p className="ant-form-text" id="static" name="static">唧唧复唧唧木兰当户织呀</p>
|
||||||
<p className="ant-form-text">
|
<p className="ant-form-text">
|
||||||
<a href="javascript:;">链接文字</a>
|
<a href="#">链接文字</a>
|
||||||
</p>
|
</p>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
@ -75,7 +75,7 @@ var Demo = React.createClass({
|
|||||||
labelCol={{span: 8}}
|
labelCol={{span: 8}}
|
||||||
wrapperCol={{span: 10}}
|
wrapperCol={{span: 10}}
|
||||||
required={true}>
|
required={true}>
|
||||||
<Slider marks={["A","B","C","D","E","F","G"]} name="slider" onChange={this.setValue.bind(this, 'slider')} />
|
<Slider marks={['A', 'B', 'C', 'D', 'E', 'F', 'G']} name="slider" onChange={this.setValue.bind(this, 'slider')} />
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
<FormItem
|
<FormItem
|
||||||
|
@ -13,7 +13,7 @@ validateStatus: ['success', 'warning', 'error', 'validating']。
|
|||||||
---
|
---
|
||||||
|
|
||||||
````jsx
|
````jsx
|
||||||
import {Form, Input, Datepicker, Row, Col} from "antd";
|
import { Form, Input, Datepicker, Col } from 'antd';
|
||||||
const FormItem = Form.Item;
|
const FormItem = Form.Item;
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
|
@ -9,7 +9,7 @@
|
|||||||
````jsx
|
````jsx
|
||||||
import { InputNumber, Button } from 'antd';
|
import { InputNumber, Button } from 'antd';
|
||||||
|
|
||||||
var Test = React.createClass({
|
const Test = React.createClass({
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
disabled: true
|
disabled: true
|
||||||
|
@ -10,13 +10,13 @@ Flex 子元素垂直对齐。
|
|||||||
````jsx
|
````jsx
|
||||||
import { Row, Col } from 'antd';
|
import { Row, Col } from 'antd';
|
||||||
|
|
||||||
var DemoBox = React.createClass({
|
const DemoBox = React.createClass({
|
||||||
render() {
|
render() {
|
||||||
const { value } = this.props;
|
const { value } = this.props;
|
||||||
const className = `hight-${value}`;
|
const className = `hight-${value}`;
|
||||||
return (
|
return (
|
||||||
<p className={className}>{this.props.children}</p>
|
<p className={className}>{this.props.children}</p>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -54,5 +54,5 @@ ReactDOM.render(
|
|||||||
</Row>
|
</Row>
|
||||||
</div>,
|
</div>,
|
||||||
document.getElementById('components-layout-demo-flex')
|
document.getElementById('components-layout-demo-flex')
|
||||||
)
|
);
|
||||||
````
|
````
|
||||||
|
@ -7,14 +7,14 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
````jsx
|
````jsx
|
||||||
import { Menu, Icon, Switch } from 'antd';
|
import { Menu, Icon } from 'antd';
|
||||||
const SubMenu = Menu.SubMenu;
|
const SubMenu = Menu.SubMenu;
|
||||||
|
|
||||||
const App = React.createClass({
|
const App = React.createClass({
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
current: 'mail'
|
current: 'mail'
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
handleClick(e) {
|
handleClick(e) {
|
||||||
console.log('click ', e);
|
console.log('click ', e);
|
||||||
|
@ -10,12 +10,12 @@
|
|||||||
import { Menu, Icon } from 'antd';
|
import { Menu, Icon } from 'antd';
|
||||||
const SubMenu = Menu.SubMenu;
|
const SubMenu = Menu.SubMenu;
|
||||||
|
|
||||||
var Sider = React.createClass({
|
const Sider = React.createClass({
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
current: '1',
|
current: '1',
|
||||||
openKeys: []
|
openKeys: []
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
handleClick(e) {
|
handleClick(e) {
|
||||||
console.log('click ', e);
|
console.log('click ', e);
|
||||||
|
@ -10,11 +10,11 @@
|
|||||||
import { Menu, Icon } from 'antd';
|
import { Menu, Icon } from 'antd';
|
||||||
const SubMenu = Menu.SubMenu;
|
const SubMenu = Menu.SubMenu;
|
||||||
|
|
||||||
var Sider = React.createClass({
|
const Sider = React.createClass({
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
current: '1'
|
current: '1'
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
handleClick(e) {
|
handleClick(e) {
|
||||||
console.log('click ', e);
|
console.log('click ', e);
|
||||||
|
@ -10,11 +10,11 @@
|
|||||||
import { Menu, Icon, Switch } from 'antd';
|
import { Menu, Icon, Switch } from 'antd';
|
||||||
const SubMenu = Menu.SubMenu;
|
const SubMenu = Menu.SubMenu;
|
||||||
|
|
||||||
var Sider = React.createClass({
|
const Sider = React.createClass({
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
theme: 'light'
|
theme: 'light'
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
changeTheme(value) {
|
changeTheme(value) {
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -9,8 +9,6 @@
|
|||||||
````jsx
|
````jsx
|
||||||
import { Modal, Button } from 'antd';
|
import { Modal, Button } from 'antd';
|
||||||
|
|
||||||
const ModalText = '对话框的内容';
|
|
||||||
|
|
||||||
const Test = React.createClass({
|
const Test = React.createClass({
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
@ -55,5 +53,5 @@ const Test = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ReactDOM.render(<Test/> , document.getElementById('components-modal-demo-async'));
|
ReactDOM.render(<Test/>, document.getElementById('components-modal-demo-async'));
|
||||||
````
|
````
|
||||||
|
@ -42,5 +42,5 @@ const App = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ReactDOM.render(<App /> , document.getElementById('components-modal-demo-basic'));
|
ReactDOM.render(<App />, document.getElementById('components-modal-demo-basic'));
|
||||||
````
|
````
|
||||||
|
@ -13,9 +13,8 @@ const confirm = Modal.confirm;
|
|||||||
function showConfirm(){
|
function showConfirm(){
|
||||||
confirm({
|
confirm({
|
||||||
title: '您是否确认要删除这项内容',
|
title: '您是否确认要删除这项内容',
|
||||||
content: '一些解释',
|
content: '点确认 1 秒后关闭',
|
||||||
onOk: function() {
|
onOk: function() {
|
||||||
alert('1 秒后关闭');
|
|
||||||
return new Promise(function(resolve) {
|
return new Promise(function(resolve) {
|
||||||
setTimeout(resolve, 1000);
|
setTimeout(resolve, 1000);
|
||||||
});
|
});
|
||||||
|
@ -15,7 +15,7 @@ function showConfirm(){
|
|||||||
title: '您是否确认要删除这项内容',
|
title: '您是否确认要删除这项内容',
|
||||||
content: '一些解释',
|
content: '一些解释',
|
||||||
onOk: function() {
|
onOk: function() {
|
||||||
alert('确定');
|
console.log('确定');
|
||||||
},
|
},
|
||||||
onCancel: function() {}
|
onCancel: function() {}
|
||||||
});
|
});
|
||||||
|
@ -54,5 +54,5 @@ const Test = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
ReactDOM.render(<Test/> , document.getElementById('components-modal-demo-footer'));
|
ReactDOM.render(<Test/>, document.getElementById('components-modal-demo-footer'));
|
||||||
````
|
````
|
||||||
|
@ -11,12 +11,12 @@ import { Button, notification } from 'antd';
|
|||||||
|
|
||||||
const openNotification = function() {
|
const openNotification = function() {
|
||||||
notification.open({
|
notification.open({
|
||||||
message: "这是标题",
|
message: '这是标题',
|
||||||
description: "这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案"
|
description: '这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案这是提示框的文案'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Button type="primary" onClick={openNotification}>打开通知提醒框</Button>
|
<Button type="primary" onClick={openNotification}>打开通知提醒框</Button>
|
||||||
,document.getElementById('components-notification-demo-basic'));
|
, document.getElementById('components-notification-demo-basic'));
|
||||||
````
|
````
|
||||||
|
@ -11,8 +11,8 @@ import { Button, notification } from 'antd';
|
|||||||
|
|
||||||
const openNotification = function() {
|
const openNotification = function() {
|
||||||
const args = {
|
const args = {
|
||||||
message: "这是标题",
|
message: '这是标题',
|
||||||
description: "我不会自动关闭,我不会自动关闭,我不会自动关闭,我不会自动关闭,我不会自动关闭,我不会自动关闭,我不会自动关闭,",
|
description: '我不会自动关闭,我不会自动关闭,我不会自动关闭,我不会自动关闭,我不会自动关闭,我不会自动关闭,我不会自动关闭',
|
||||||
duration: 0
|
duration: 0
|
||||||
};
|
};
|
||||||
notification.open(args);
|
notification.open(args);
|
||||||
|
@ -10,13 +10,13 @@
|
|||||||
import { Button, notification } from 'antd';
|
import { Button, notification } from 'antd';
|
||||||
|
|
||||||
const close = function() {
|
const close = function() {
|
||||||
console.log("我被默认的关闭按钮关闭了!");
|
console.log('我被默认的关闭按钮关闭了!');
|
||||||
};
|
};
|
||||||
|
|
||||||
const openNotification = function() {
|
const openNotification = function() {
|
||||||
const args = {
|
const args = {
|
||||||
message: "这是标题",
|
message: '这是标题',
|
||||||
description: "这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案",
|
description: '这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案',
|
||||||
onClose: close
|
onClose: close
|
||||||
};
|
};
|
||||||
notification.open(args);
|
notification.open(args);
|
||||||
|
@ -9,12 +9,12 @@
|
|||||||
````jsx
|
````jsx
|
||||||
import { Button, notification } from 'antd';
|
import { Button, notification } from 'antd';
|
||||||
|
|
||||||
const close = function(){
|
const close = function() {
|
||||||
console.log('我被默认的关闭按钮关闭了!');
|
console.log('我被默认的关闭按钮关闭了!');
|
||||||
}
|
};
|
||||||
|
|
||||||
const openNotification = function() {
|
const openNotification = function() {
|
||||||
const key='open'+Date.now();
|
const key = 'open' + Date.now();
|
||||||
const btnClick = function() {
|
const btnClick = function() {
|
||||||
// 隐藏提醒框
|
// 隐藏提醒框
|
||||||
notification.close(key);
|
notification.close(key);
|
||||||
@ -23,8 +23,8 @@ const openNotification = function() {
|
|||||||
自定义关闭按钮并触发回调函数
|
自定义关闭按钮并触发回调函数
|
||||||
</Button>;
|
</Button>;
|
||||||
notification.open({
|
notification.open({
|
||||||
message: "这是标题",
|
message: '这是标题',
|
||||||
description: "这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案",
|
description: '这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案',
|
||||||
btn: btn,
|
btn: btn,
|
||||||
key: key,
|
key: key,
|
||||||
onClose: close
|
onClose: close
|
||||||
|
@ -12,8 +12,8 @@ import { Button, notification } from 'antd';
|
|||||||
const openNotificationWithIcon = function(type) {
|
const openNotificationWithIcon = function(type) {
|
||||||
return function(){
|
return function(){
|
||||||
notification[type]({
|
notification[type]({
|
||||||
message: "这是标题",
|
message: '这是标题',
|
||||||
description: "这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案"
|
description: '这是提示框的文案这是提示框示框的文案这是提示是提示框的文案这是提示框的文案'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -19,7 +19,7 @@ function cancel() {
|
|||||||
|
|
||||||
ReactDOM.render(
|
ReactDOM.render(
|
||||||
<Popconfirm title="确定要删除这个任务吗?" onConfirm={confirm} onCancel={cancel}>
|
<Popconfirm title="确定要删除这个任务吗?" onConfirm={confirm} onCancel={cancel}>
|
||||||
<a href="javascript:;">删除</a>
|
<a href="#">删除</a>
|
||||||
</Popconfirm>
|
</Popconfirm>
|
||||||
, document.getElementById('components-popconfirm-demo-basic'));
|
, document.getElementById('components-popconfirm-demo-basic'));
|
||||||
````
|
````
|
||||||
|
@ -54,7 +54,7 @@ const Test = React.createClass({
|
|||||||
<div className="demo-list">
|
<div className="demo-list">
|
||||||
<div className="title"></div>
|
<div className="title"></div>
|
||||||
<QueueAnim component="ul" type={['right', 'left']}>
|
<QueueAnim component="ul" type={['right', 'left']}>
|
||||||
{this.state.show ? this.state.items: null}
|
{this.state.show ? this.state.items : null}
|
||||||
</QueueAnim>
|
</QueueAnim>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -13,12 +13,12 @@ const Test = React.createClass({
|
|||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
show: true,
|
show: true,
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
onClick() {
|
onClick() {
|
||||||
this.setState({
|
this.setState({
|
||||||
show: !this.state.show,
|
show: !this.state.show,
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
@ -52,7 +52,7 @@ const Test = React.createClass({
|
|||||||
] : null}
|
] : null}
|
||||||
</QueueAnim>
|
</QueueAnim>
|
||||||
</div>
|
</div>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ const Test = React.createClass({
|
|||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
]: null}
|
] : null}
|
||||||
</QueueAnim>
|
</QueueAnim>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -7,8 +7,7 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
````jsx
|
````jsx
|
||||||
import { QueueAnim, Button, Select, Checkbox, Radio } from 'antd';
|
import { QueueAnim, Button, Checkbox, Radio } from 'antd';
|
||||||
const Option = Select.Option;
|
|
||||||
const RadioGroup = Radio.Group;
|
const RadioGroup = Radio.Group;
|
||||||
|
|
||||||
const Test = React.createClass({
|
const Test = React.createClass({
|
||||||
@ -30,19 +29,19 @@ const Test = React.createClass({
|
|||||||
</p>
|
</p>
|
||||||
<QueueAnim component="form" className="ant-form-horizontal" type="bottom" leaveReverse={true}>
|
<QueueAnim component="form" className="ant-form-horizontal" type="bottom" leaveReverse={true}>
|
||||||
{this.state.show ? [
|
{this.state.show ? [
|
||||||
<div className="ant-form-item ant-form-item-compact" key='name'>
|
<div className="ant-form-item ant-form-item-compact" key="name">
|
||||||
<label htmlFor="userName" className="col-6" required>用户名:</label>
|
<label htmlFor="userName" className="col-6" required>用户名:</label>
|
||||||
<div className="col-6">
|
<div className="col-6">
|
||||||
<p className="ant-form-text">大眼萌 minion</p>
|
<p className="ant-form-text">大眼萌 minion</p>
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
<div className="ant-form-item" key='password'>
|
<div className="ant-form-item" key="password">
|
||||||
<label htmlFor="password" className="col-6" required>密码:</label>
|
<label htmlFor="password" className="col-6" required>密码:</label>
|
||||||
<div className="col-14">
|
<div className="col-14">
|
||||||
<input className="ant-input" type="password" id="password" placeholder="请输入密码"/>
|
<input className="ant-input" type="password" id="password" placeholder="请输入密码"/>
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
<div className="ant-form-item ant-form-item-compact" key='sex'>
|
<div className="ant-form-item ant-form-item-compact" key="sex">
|
||||||
<label className="col-6" required>您的性别:</label>
|
<label className="col-6" required>您的性别:</label>
|
||||||
<div className="col-14">
|
<div className="col-14">
|
||||||
<RadioGroup value="male">
|
<RadioGroup value="male">
|
||||||
@ -51,14 +50,14 @@ const Test = React.createClass({
|
|||||||
</RadioGroup>
|
</RadioGroup>
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
<div className="ant-form-item" key='remark'>
|
<div className="ant-form-item" key="remark">
|
||||||
<label htmlFor="remark" className="col-6" required>备注:</label>
|
<label htmlFor="remark" className="col-6" required>备注:</label>
|
||||||
<div className="col-14">
|
<div className="col-14">
|
||||||
<textarea className="ant-input" id="remark" placeholder="随便写"></textarea>
|
<textarea className="ant-input" id="remark" placeholder="随便写"></textarea>
|
||||||
<p className="ant-form-explain">随便写点什么</p>
|
<p className="ant-form-explain">随便写点什么</p>
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
<div className="ant-form-item ant-form-item-compact" key='checkbox'>
|
<div className="ant-form-item ant-form-item-compact" key="checkbox">
|
||||||
<div className="col-14 col-offset-6">
|
<div className="col-14 col-offset-6">
|
||||||
<label>
|
<label>
|
||||||
<Checkbox />
|
<Checkbox />
|
||||||
@ -66,7 +65,7 @@ const Test = React.createClass({
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>,
|
</div>,
|
||||||
<div className="row" key='btn'>
|
<div className="row" key="btn">
|
||||||
<div className="col-16 col-offset-6">
|
<div className="col-16 col-offset-6">
|
||||||
<Button type="primary">确定</Button>
|
<Button type="primary">确定</Button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -29,7 +29,7 @@ const App = React.createClass({
|
|||||||
</Menu.Item>
|
</Menu.Item>
|
||||||
</Menu>
|
</Menu>
|
||||||
<QueueAnim type={['right', 'left']} className="demo-router-wrap">
|
<QueueAnim type={['right', 'left']} className="demo-router-wrap">
|
||||||
{React.cloneElement(this.props.children||<Home/>, {key: key})}
|
{React.cloneElement(this.props.children || <Home/>, {key: key})}
|
||||||
</QueueAnim>
|
</QueueAnim>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
@ -83,7 +83,7 @@ const Page1 = React.createClass({
|
|||||||
<div className="demo-listBox">
|
<div className="demo-listBox">
|
||||||
<QueueAnim className="demo-list" delay={200}>
|
<QueueAnim className="demo-list" delay={200}>
|
||||||
<div className="title" key="title3"></div>
|
<div className="title" key="title3"></div>
|
||||||
<QueueAnim component="ul" animConfig={{opacity:[1, 0],translateY:[0, 30],scale:[1,0.9]}} key="ul">
|
<QueueAnim component="ul" animConfig={{opacity:[1, 0], translateY:[0, 30], scale:[1, 0.9]}} key="ul">
|
||||||
<li key="0"></li>
|
<li key="0"></li>
|
||||||
<li key="1"></li>
|
<li key="1"></li>
|
||||||
<li key="2"></li>
|
<li key="2"></li>
|
||||||
@ -104,7 +104,7 @@ const Page2 = React.createClass({
|
|||||||
<div className="demo-listBox">
|
<div className="demo-listBox">
|
||||||
<QueueAnim className="demo-list">
|
<QueueAnim className="demo-list">
|
||||||
<div className="title" key="title3"></div>
|
<div className="title" key="title3"></div>
|
||||||
<QueueAnim component="ul" animConfig={{opacity:[1, 0],translateY:[0, 30],scale:[1,0.9]}} key="li">
|
<QueueAnim component="ul" animConfig={{opacity:[1, 0], translateY:[0, 30], scale:[1, 0.9]}} key="li">
|
||||||
<li key="0"></li>
|
<li key="0"></li>
|
||||||
<li key="1"></li>
|
<li key="1"></li>
|
||||||
<li key="2"></li>
|
<li key="2"></li>
|
||||||
|
@ -9,10 +9,6 @@ Radio 不可用。
|
|||||||
````jsx
|
````jsx
|
||||||
import { Radio, Button } from 'antd';
|
import { Radio, Button } from 'antd';
|
||||||
|
|
||||||
function toggleDisabled() {
|
|
||||||
disabled = !disabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
const App = React.createClass({
|
const App = React.createClass({
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
|
@ -24,13 +24,11 @@ const IconSlider = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleChange(v) {
|
handleChange(v) {
|
||||||
this.setState(
|
this.setState({
|
||||||
{
|
|
||||||
preIconClass: v >= this.state.mid ? '' : 'anticon-highlight',
|
preIconClass: v >= this.state.mid ? '' : 'anticon-highlight',
|
||||||
nextIconClass: v >= this.state.mid ? 'anticon-highlight': '',
|
nextIconClass: v >= this.state.mid ? 'anticon-highlight' : '',
|
||||||
sliderValue: v
|
sliderValue: v
|
||||||
}
|
});
|
||||||
);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -12,8 +12,8 @@ const Step = Steps.Step;
|
|||||||
const container = document.getElementById('components-steps-demo-icon');
|
const container = document.getElementById('components-steps-demo-icon');
|
||||||
|
|
||||||
ReactDOM.render(<Steps>
|
ReactDOM.render(<Steps>
|
||||||
<Step status='finish' title='步骤1' icon='cloud' />
|
<Step status="finish" title="步骤1" icon="cloud" />
|
||||||
<Step status='process' title='步骤2' icon='apple' />
|
<Step status="process" title="步骤2" icon="apple" />
|
||||||
<Step status='wait' title='步骤3' icon='github' />
|
<Step status="wait" title="步骤3" icon="github" />
|
||||||
</Steps>, container);
|
</Steps>, container);
|
||||||
````
|
````
|
||||||
|
@ -27,7 +27,7 @@ const App = React.createClass({
|
|||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
currentStep: Math.floor(Math.random() * steps.length)
|
currentStep: Math.floor(Math.random() * steps.length)
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
next() {
|
next() {
|
||||||
let s = this.state.currentStep + 1;
|
let s = this.state.currentStep + 1;
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
````jsx
|
````jsx
|
||||||
import { Steps, Button } from 'antd';
|
import { Steps } from 'antd';
|
||||||
const Step = Steps.Step;
|
const Step = Steps.Step;
|
||||||
const container = document.getElementById('components-steps-demo-vertical-small');
|
const container = document.getElementById('components-steps-demo-vertical-small');
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
````jsx
|
````jsx
|
||||||
import { Steps, Button } from 'antd';
|
import { Steps } from 'antd';
|
||||||
const Step = Steps.Step;
|
const Step = Steps.Step;
|
||||||
const container = document.getElementById('components-steps-demo-vertical');
|
const container = document.getElementById('components-steps-demo-vertical');
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ const Test = React.createClass({
|
|||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
disabled: true
|
disabled: true
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
toggle(){
|
toggle(){
|
||||||
this.setState({
|
this.setState({
|
||||||
|
@ -31,7 +31,7 @@ const columns = [{
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
const dataSource = new Table.DataSource({
|
const dataSource = new Table.DataSource({
|
||||||
url: "/components/table/demo/data.json",
|
url: '/components/table/demo/data.json',
|
||||||
resolve: function(result) {
|
resolve: function(result) {
|
||||||
return result.data;
|
return result.data;
|
||||||
},
|
},
|
||||||
@ -41,7 +41,7 @@ const dataSource = new Table.DataSource({
|
|||||||
return {
|
return {
|
||||||
total: result.totalCount,
|
total: result.totalCount,
|
||||||
pageSize: result.pageSize
|
pageSize: result.pageSize
|
||||||
}
|
};
|
||||||
},
|
},
|
||||||
// 和后台接口接收的参数进行适配
|
// 和后台接口接收的参数进行适配
|
||||||
// 参数里提供了分页、筛选、排序的信息
|
// 参数里提供了分页、筛选、排序的信息
|
||||||
|
@ -13,7 +13,7 @@ const columns = [{
|
|||||||
title: '姓名',
|
title: '姓名',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
render: function(text) {
|
render: function(text) {
|
||||||
return <a href="javascript:;">{text}</a>;
|
return <a href="#">{text}</a>;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
title: '年龄',
|
title: '年龄',
|
||||||
@ -26,11 +26,11 @@ const columns = [{
|
|||||||
dataIndex: '',
|
dataIndex: '',
|
||||||
render: function(text, record) {
|
render: function(text, record) {
|
||||||
return <span>
|
return <span>
|
||||||
<a href="javascript:;">操作一</a>
|
<a href="#">操作一</a>
|
||||||
<span className="ant-divider"></span>
|
<span className="ant-divider"></span>
|
||||||
<a href="javascript:;">操作二</a>
|
<a href="#">操作二</a>
|
||||||
<span className="ant-divider"></span>
|
<span className="ant-divider"></span>
|
||||||
<a href="javascript:;" className="ant-dropdown-link">
|
<a href="#" className="ant-dropdown-link">
|
||||||
更多 <Icon type="down" />
|
更多 <Icon type="down" />
|
||||||
</a>
|
</a>
|
||||||
</span>;
|
</span>;
|
||||||
|
@ -13,7 +13,7 @@ const columns = [{
|
|||||||
title: '姓名',
|
title: '姓名',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
render: function(text) {
|
render: function(text) {
|
||||||
return <a href="javascript:;">{text}</a>;
|
return <a href="#">{text}</a>;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
title: '资产',
|
title: '资产',
|
||||||
|
@ -17,7 +17,7 @@ const renderContent = function(value, row, index) {
|
|||||||
let obj = {
|
let obj = {
|
||||||
children: value,
|
children: value,
|
||||||
props: {}
|
props: {}
|
||||||
}
|
};
|
||||||
if (index === 4) {
|
if (index === 4) {
|
||||||
obj.props.colSpan = 0;
|
obj.props.colSpan = 0;
|
||||||
}
|
}
|
||||||
@ -29,14 +29,14 @@ const columns = [{
|
|||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
render: function(text, row, index) {
|
render: function(text, row, index) {
|
||||||
if (index < 4) {
|
if (index < 4) {
|
||||||
return <a href="javascript:;">{text}</a>;
|
return <a href="#">{text}</a>;
|
||||||
} else {
|
} else {
|
||||||
return {
|
return {
|
||||||
children: <a href="javascript:;">{text}</a>,
|
children: <a href="#">{text}</a>,
|
||||||
props: {
|
props: {
|
||||||
colSpan: 5
|
colSpan: 5
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
@ -51,7 +51,7 @@ const columns = [{
|
|||||||
let obj = {
|
let obj = {
|
||||||
children: value,
|
children: value,
|
||||||
props:{}
|
props:{}
|
||||||
}
|
};
|
||||||
// 第三列的第三行行合并
|
// 第三列的第三行行合并
|
||||||
if (index === 2) {
|
if (index === 2) {
|
||||||
obj.props.rowSpan = 2;
|
obj.props.rowSpan = 2;
|
||||||
@ -113,7 +113,7 @@ const data = [{
|
|||||||
tel: '0575-22098909',
|
tel: '0575-22098909',
|
||||||
phone: 18900010002,
|
phone: 18900010002,
|
||||||
address: '西湖区湖底公园1号'
|
address: '西湖区湖底公园1号'
|
||||||
}];
|
}];
|
||||||
|
|
||||||
ReactDOM.render(<Table columns={columns} dataSource={data} bordered={true} />
|
ReactDOM.render(<Table columns={columns} dataSource={data} bordered={true} />
|
||||||
, document.getElementById('components-table-demo-colspan-rowspan'));
|
, document.getElementById('components-table-demo-colspan-rowspan'));
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
import { Table } from 'antd';
|
import { Table } from 'antd';
|
||||||
|
|
||||||
function renderAction() {
|
function renderAction() {
|
||||||
return <a href="javascript:;">删除</a>;
|
return <a href="#">删除</a>;
|
||||||
}
|
}
|
||||||
|
|
||||||
function expandedRowRender(record) {
|
function expandedRowRender(record) {
|
||||||
|
@ -53,7 +53,7 @@ const App = React.createClass({
|
|||||||
<Button type="primary" onClick={this.toggleLoading}>切换 loading 状态</Button>
|
<Button type="primary" onClick={this.toggleLoading}>切换 loading 状态</Button>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
ReactDOM.render(<App />, document.getElementById('components-table-demo-loading'));
|
ReactDOM.render(<App />, document.getElementById('components-table-demo-loading'));
|
||||||
````
|
````
|
||||||
|
@ -13,7 +13,7 @@ const columns = [{
|
|||||||
title: '姓名',
|
title: '姓名',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
render: function(text) {
|
render: function(text) {
|
||||||
return <a href="javascript:;">{text}</a>;
|
return <a href="#">{text}</a>;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
title: '年龄',
|
title: '年龄',
|
||||||
@ -79,9 +79,8 @@ const App = React.createClass({
|
|||||||
<Button onClick={this.handleClick2}>加载本地数据2</Button>
|
<Button onClick={this.handleClick2}>加载本地数据2</Button>
|
||||||
</div>;
|
</div>;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
ReactDOM.render(<App />
|
ReactDOM.render(<App />
|
||||||
, document.getElementById('components-table-demo-local-data'));
|
, document.getElementById('components-table-demo-local-data'));
|
||||||
````
|
````
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ const columns = [{
|
|||||||
title: '姓名',
|
title: '姓名',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
render: function(text) {
|
render: function(text) {
|
||||||
return <a href="javascript:;">{text}</a>;
|
return <a href="#">{text}</a>;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
title: '年龄',
|
title: '年龄',
|
||||||
@ -24,7 +24,7 @@ const columns = [{
|
|||||||
}];
|
}];
|
||||||
|
|
||||||
const data = [];
|
const data = [];
|
||||||
for (let i=0; i<46; i++) {
|
for (let i = 0; i < 46; i++) {
|
||||||
data.push({
|
data.push({
|
||||||
key: i,
|
key: i,
|
||||||
name: '李大嘴' + i,
|
name: '李大嘴' + i,
|
||||||
|
@ -13,7 +13,7 @@ const columns = [{
|
|||||||
title: '姓名',
|
title: '姓名',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
render: function(text) {
|
render: function(text) {
|
||||||
return <a href="javascript:;">{text}</a>;
|
return <a href="#">{text}</a>;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
title: '年龄',
|
title: '年龄',
|
||||||
|
@ -13,7 +13,7 @@ const columns = [{
|
|||||||
title: '姓名',
|
title: '姓名',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
render: function(text) {
|
render: function(text) {
|
||||||
return <a href="javascript:;">{text}</a>;
|
return <a href="#">{text}</a>;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
title: '年龄',
|
title: '年龄',
|
||||||
|
@ -13,7 +13,7 @@ const columns = [{
|
|||||||
title: '姓名',
|
title: '姓名',
|
||||||
dataIndex: 'name',
|
dataIndex: 'name',
|
||||||
render: function(text) {
|
render: function(text) {
|
||||||
return <a href="javascript:;">{text}</a>;
|
return <a href="#">{text}</a>;
|
||||||
}
|
}
|
||||||
}, {
|
}, {
|
||||||
title: '年龄',
|
title: '年龄',
|
||||||
|
@ -37,7 +37,7 @@ const Test = React.createClass({
|
|||||||
activeKey: index.toString()
|
activeKey: index.toString()
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
remove(index, e) {
|
remove(targetIndex, e) {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
let tabs = this.state.tabs;
|
let tabs = this.state.tabs;
|
||||||
let activeKey = this.state.activeKey;
|
let activeKey = this.state.activeKey;
|
||||||
@ -49,15 +49,15 @@ const Test = React.createClass({
|
|||||||
}
|
}
|
||||||
|
|
||||||
const newTabs = tabs.filter(tab => {
|
const newTabs = tabs.filter(tab => {
|
||||||
if (tab.index !== index) {
|
if (tab.index !== targetIndex) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
foundIndex = index;
|
foundIndex = targetIndex;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (activeKey === index) {
|
if (activeKey === targetIndex) {
|
||||||
activeKey = tabs[foundIndex - 1].index;
|
activeKey = tabs[foundIndex - 1].index;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ const Test = React.createClass({
|
|||||||
</Tabs>
|
</Tabs>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
ReactDOM.render(<Test />, document.getElementById('components-tabs-demo-add'));
|
ReactDOM.render(<Test />, document.getElementById('components-tabs-demo-add'));
|
||||||
````
|
````
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
import { Tabs, Icon } from 'antd';
|
import { Tabs, Icon } from 'antd';
|
||||||
const TabPane = Tabs.TabPane;
|
const TabPane = Tabs.TabPane;
|
||||||
|
|
||||||
var tabContent = [
|
const tabContent = [
|
||||||
<span><Icon type="apple" />选项卡一</span>,
|
<span><Icon type="apple" />选项卡一</span>,
|
||||||
<span><Icon type="android" />选项卡二</span>,
|
<span><Icon type="android" />选项卡二</span>,
|
||||||
<span><Icon type="lock" />选项卡三</span>,
|
<span><Icon type="lock" />选项卡三</span>,
|
||||||
|
@ -10,22 +10,23 @@
|
|||||||
import { Tree } from 'antd';
|
import { Tree } from 'antd';
|
||||||
const TreeNode = Tree.TreeNode;
|
const TreeNode = Tree.TreeNode;
|
||||||
|
|
||||||
const asyncTree = [
|
const asyncTree = [{
|
||||||
{name: "pNode 01", key: "0-0"},
|
name: 'pNode 01',
|
||||||
];
|
key: '0-0'
|
||||||
|
}];
|
||||||
|
|
||||||
const generateTreeNodes = () => {
|
const generateTreeNodes = () => {
|
||||||
const arr = [
|
return [{
|
||||||
{name: "伯约", key: "0-0-0"},
|
name: '伯约',
|
||||||
];
|
key: '0-0-0'
|
||||||
return arr;
|
}];
|
||||||
}
|
};
|
||||||
|
|
||||||
const TreeDemo = React.createClass({
|
const TreeDemo = React.createClass({
|
||||||
timeout(duration = 0) {
|
timeout(duration = 0) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
setTimeout(resolve.bind(this), duration);
|
setTimeout(resolve.bind(this), duration);
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
@ -62,9 +63,9 @@ const TreeDemo = React.createClass({
|
|||||||
if (item.children) {
|
if (item.children) {
|
||||||
return <TreeNode title={item.name} key={item.key}>{loop(item.children)}</TreeNode>;
|
return <TreeNode title={item.name} key={item.key}>{loop(item.children)}</TreeNode>;
|
||||||
} else {
|
} else {
|
||||||
return <TreeNode title={item.name} key={item.key}></TreeNode>;
|
return <TreeNode title={item.name} key={item.key} />;
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
};
|
};
|
||||||
const parseTreeNode = data => loop(data);
|
const parseTreeNode = data => loop(data);
|
||||||
let treeNodes = parseTreeNode(this.state.treeData);
|
let treeNodes = parseTreeNode(this.state.treeData);
|
||||||
@ -72,9 +73,9 @@ const TreeDemo = React.createClass({
|
|||||||
<Tree onSelect={this.handleSelect} onDataLoaded={this.handleDataLoaded} showLine={false}>
|
<Tree onSelect={this.handleSelect} onDataLoaded={this.handleDataLoaded} showLine={false}>
|
||||||
{treeNodes}
|
{treeNodes}
|
||||||
</Tree>
|
</Tree>
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
})
|
});
|
||||||
|
|
||||||
ReactDOM.render(<TreeDemo />, document.getElementById('components-tree-demo-dynamic'));
|
ReactDOM.render(<TreeDemo />, document.getElementById('components-tree-demo-dynamic'));
|
||||||
````
|
````
|
||||||
|
@ -19,27 +19,27 @@ class TreeDemo extends React.Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
checkedKeys: [],
|
checkedKeys: [],
|
||||||
selectedKeys: []
|
selectedKeys: []
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
handleClick() {
|
handleClick() {
|
||||||
this.setState({
|
this.setState({
|
||||||
checkedKeys: ['p11'],
|
checkedKeys: ['p11'],
|
||||||
selectedKeys: ['p21', 'p11']
|
selectedKeys: ['p21', 'p11']
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
handleCheck(info) {
|
handleCheck(info) {
|
||||||
console.log('check: ', info);
|
console.log('check: ', info);
|
||||||
this.setState({
|
this.setState({
|
||||||
checkedKeys: ['p21'],
|
checkedKeys: ['p21'],
|
||||||
selectedKeys: ['p1', 'p21']
|
selectedKeys: ['p1', 'p21']
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
handleSelect(info) {
|
handleSelect(info) {
|
||||||
console.log('selected: ', info);
|
console.log('selected: ', info);
|
||||||
this.setState({
|
this.setState({
|
||||||
checkedKeys: ['p21'],
|
checkedKeys: ['p21'],
|
||||||
selectedKeys: ['p21']
|
selectedKeys: ['p21']
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
render() {
|
render() {
|
||||||
return (<div>
|
return (<div>
|
||||||
|
@ -15,17 +15,15 @@
|
|||||||
````jsx
|
````jsx
|
||||||
import { Upload, Button, Icon } from 'antd';
|
import { Upload, Button, Icon } from 'antd';
|
||||||
|
|
||||||
const fileList = [{
|
const MyUpload = React.createClass({
|
||||||
|
getInitialState() {
|
||||||
|
return {
|
||||||
|
fileList: [{
|
||||||
uid: -1,
|
uid: -1,
|
||||||
name: 'xxx.png',
|
name: 'xxx.png',
|
||||||
status: 'done',
|
status: 'done',
|
||||||
url: 'http://www.baidu.com/xxx.png'
|
url: 'http://www.baidu.com/xxx.png'
|
||||||
}];
|
}]
|
||||||
|
|
||||||
const MyUpload = React.createClass({
|
|
||||||
getInitialState() {
|
|
||||||
return {
|
|
||||||
fileList: fileList
|
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
handleChange(info) {
|
handleChange(info) {
|
||||||
@ -52,9 +50,7 @@ const MyUpload = React.createClass({
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setState({
|
this.setState({ fileList });
|
||||||
fileList: fileList
|
|
||||||
});
|
|
||||||
},
|
},
|
||||||
render() {
|
render() {
|
||||||
const props = {
|
const props = {
|
||||||
|
@ -147,7 +147,7 @@ const Demo = React.createClass({
|
|||||||
wrapperCol={{span: 12}}
|
wrapperCol={{span: 12}}
|
||||||
validateStatus={this.renderValidateStyle('name')}
|
validateStatus={this.renderValidateStyle('name')}
|
||||||
hasFeedback
|
hasFeedback
|
||||||
help={status.name.isValidating ? "正在校验中.." : status.name.errors ? status.name.errors.join(',') : null}
|
help={status.name.isValidating ? '正在校验中..' : (status.name.errors && status.name.errors.join(','))}
|
||||||
required>
|
required>
|
||||||
<Validator rules={[{required: true, min: 5, message: '用户名至少为 5 个字符'}, {validator: this.userExists}]}>
|
<Validator rules={[{required: true, min: 5, message: '用户名至少为 5 个字符'}, {validator: this.userExists}]}>
|
||||||
<Input name="name" id="name" value={formData.name} placeholder="实时校验,输入 JasonWood 看看" onChange={this.setField.bind(this, 'name')} />
|
<Input name="name" id="name" value={formData.name} placeholder="实时校验,输入 JasonWood 看看" onChange={this.setField.bind(this, 'name')} />
|
||||||
|
@ -40,7 +40,7 @@ const Demo = React.createClass({
|
|||||||
|
|
||||||
handleSubmit(e) {
|
handleSubmit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
var validation = this.refs.validation;
|
const validation = this.refs.validation;
|
||||||
validation.validate((valid) => {
|
validation.validate((valid) => {
|
||||||
if (!valid) {
|
if (!valid) {
|
||||||
console.log('error in form');
|
console.log('error in form');
|
||||||
@ -82,9 +82,17 @@ const Demo = React.createClass({
|
|||||||
} else {
|
} else {
|
||||||
strength = 'H';
|
strength = 'H';
|
||||||
}
|
}
|
||||||
type === 'pass' ? this.setState({ passBarShow: true, passStrength: strength }) : this.setState({ rePassBarShow: true, rePassStrength: strength });
|
if (type === 'pass') {
|
||||||
|
this.setState({ passBarShow: true, passStrength: strength });
|
||||||
} else {
|
} else {
|
||||||
type === 'pass' ? this.setState({ passBarShow: false }) : this.setState({ rePassBarShow: false });
|
this.setState({ rePassBarShow: true, rePassStrength: strength });
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (type === 'pass') {
|
||||||
|
this.setState({ passBarShow: false });
|
||||||
|
} else {
|
||||||
|
this.setState({ rePassBarShow: false });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -25,10 +25,6 @@ function cx(classNames) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function noop() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
const Demo = React.createClass({
|
const Demo = React.createClass({
|
||||||
mixins: [Validation.FieldMixin],
|
mixins: [Validation.FieldMixin],
|
||||||
|
|
||||||
@ -119,7 +115,7 @@ const Demo = React.createClass({
|
|||||||
help={status.select.errors ? status.select.errors.join(',') : null}
|
help={status.select.errors ? status.select.errors.join(',') : null}
|
||||||
required>
|
required>
|
||||||
<Validator rules={[{required: true, message: '请选择您的国籍'}]}>
|
<Validator rules={[{required: true, message: '请选择您的国籍'}]}>
|
||||||
<Select size="large" placeholder="请选择国家" style={{width:"100%"}} name="select" value={formData.select}>
|
<Select size="large" placeholder="请选择国家" style={{width: '100%'}} name="select" value={formData.select}>
|
||||||
<Option value="china">中国</Option>
|
<Option value="china">中国</Option>
|
||||||
<Option value="use">美国</Option>
|
<Option value="use">美国</Option>
|
||||||
<Option value="japan">日本</Option>
|
<Option value="japan">日本</Option>
|
||||||
@ -137,7 +133,7 @@ const Demo = React.createClass({
|
|||||||
help={status.multiSelect.errors ? status.multiSelect.errors.join(',') : null}
|
help={status.multiSelect.errors ? status.multiSelect.errors.join(',') : null}
|
||||||
required>
|
required>
|
||||||
<Validator rules={[{required: true, message: '请选择您喜欢的颜色', type: 'array'}]}>
|
<Validator rules={[{required: true, message: '请选择您喜欢的颜色', type: 'array'}]}>
|
||||||
<Select multiple size="large" placeholder="请选择颜色" style={{width:"100%"}} name="multiSelect" value={formData.multiSelect}>
|
<Select multiple size="large" placeholder="请选择颜色" style={{width: '100%'}} name="multiSelect" value={formData.multiSelect}>
|
||||||
<Option value="red">红色</Option>
|
<Option value="red">红色</Option>
|
||||||
<Option value="orange">橙色</Option>
|
<Option value="orange">橙色</Option>
|
||||||
<Option value="yellow">黄色</Option>
|
<Option value="yellow">黄色</Option>
|
||||||
@ -176,7 +172,7 @@ const Demo = React.createClass({
|
|||||||
type: 'date',
|
type: 'date',
|
||||||
message: '你的生日是什么呢?'
|
message: '你的生日是什么呢?'
|
||||||
}, {validator: this.checkBirthday}]}>
|
}, {validator: this.checkBirthday}]}>
|
||||||
<Datepicker name="birthday" value={formData.birthday}></Datepicker>
|
<Datepicker name="birthday" value={formData.birthday} />
|
||||||
</Validator>
|
</Validator>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
@ -189,7 +185,7 @@ const Demo = React.createClass({
|
|||||||
help={status.primeNumber.errors ? status.primeNumber.errors.join(',') : null}
|
help={status.primeNumber.errors ? status.primeNumber.errors.join(',') : null}
|
||||||
required>
|
required>
|
||||||
<Validator rules={[{validator: this.checkPrime}]}>
|
<Validator rules={[{validator: this.checkPrime}]}>
|
||||||
<InputNumber name="primeNumber" min={8} max={12} value={formData.primeNumber}/>
|
<InputNumber name="primeNumber" min={8} max={12} value={formData.primeNumber} />
|
||||||
</Validator>
|
</Validator>
|
||||||
</FormItem>
|
</FormItem>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user