docs: translated cascader demo (#2997)

This commit is contained in:
Shawn Sit 2016-09-10 18:23:24 +08:00 committed by Benjy Cui
parent 25cb3e2d30
commit 57cdbe1a6b
8 changed files with 52 additions and 52 deletions

View File

@ -18,24 +18,24 @@ import { Cascader } from 'antd';
const options = [{
value: 'zhejiang',
label: '浙江',
label: 'Zhejiang',
children: [{
value: 'hangzhou',
label: '杭州',
label: 'Hangzhou',
children: [{
value: 'xihu',
label: '西湖',
label: 'West Lake',
}],
}],
}, {
value: 'jiangsu',
label: '江苏',
label: 'Jiangsu',
children: [{
value: 'nanjing',
label: '南京',
label: 'Nanjing',
children: [{
value: 'zhonghuamen',
label: '中华门',
label: 'Zhong Hua Men',
}],
}],
}];
@ -45,6 +45,6 @@ function onChange(value) {
}
ReactDOM.render(
<Cascader options={options} onChange={onChange} placeholder="请选择地区" />
<Cascader options={options} onChange={onChange} placeholder="Please select" />
, mountNode);
````

View File

@ -18,24 +18,24 @@ import { Cascader } from 'antd';
const options = [{
value: 'zhejiang',
label: '浙江',
label: 'Zhejiang',
children: [{
value: 'hangzhou',
label: '杭州',
label: 'Hanzhou',
children: [{
value: 'xihu',
label: '西湖',
label: 'West Lake',
}],
}],
}, {
value: 'jiangsu',
label: '江苏',
label: 'Jiangsu',
children: [{
value: 'nanjing',
label: '南京',
label: 'Nanjing',
children: [{
value: 'zhonghuamen',
label: '中华门',
label: 'Zhong Hua Men',
}],
}],
}];

View File

@ -18,25 +18,25 @@ import { Cascader } from 'antd';
const options = [{
value: 'zhejiang',
label: '浙江',
label: 'Zhejiang',
children: [{
value: 'hangzhou',
label: '杭州',
label: 'Hangzhou',
children: [{
value: 'xihu',
label: '西湖',
label: 'West Lake',
code: 752100,
}],
}],
}, {
value: 'jiangsu',
label: '江苏',
label: 'Jiangsu',
children: [{
value: 'nanjing',
label: '南京',
label: 'Nanjing',
children: [{
value: 'zhonghuamen',
label: '中华门',
label: 'Zhong Hua Men',
code: 453400,
}],
}],
@ -44,7 +44,7 @@ const options = [{
function handleAreaClick(e, label, option) {
e.stopPropagation();
console.log('点击了', label, option);
console.log('clicked', label, option);
}
const displayRender = (labels, selectedOptions) => labels.map((label, i) => {

View File

@ -18,24 +18,24 @@ import { Cascader } from 'antd';
const options = [{
value: 'zhejiang',
label: '浙江',
label: 'Zhejiang',
children: [{
value: 'hangzhou',
label: '杭州',
label: 'Hangzhou',
children: [{
value: 'xihu',
label: '西湖',
label: 'West Lake',
}],
}],
}, {
value: 'jiangsu',
label: '江苏',
label: 'Jiangsu',
children: [{
value: 'nanjing',
label: '南京',
label: 'Nanjing',
children: [{
value: 'zhonghuamen',
label: '中华门',
label: 'Zhong Hua Men',
}],
}],
}];

View File

@ -18,25 +18,25 @@ import { Cascader } from 'antd';
const options = [{
value: 'zhejiang',
label: '浙江',
label: 'Zhejiang',
children: [{
value: 'hangzhou',
label: '杭州',
label: 'Hangzhou',
children: [{
value: 'xihu',
label: '西湖',
label: 'West Lake',
}],
}],
}, {
value: 'jiangsu',
label: '江苏',
label: 'Jiangsu',
disabled: true,
children: [{
value: 'nanjing',
label: '南京',
label: 'Nanjing',
children: [{
value: 'zhonghuamen',
label: '中华门',
label: 'Zhong Hua Men',
}],
}],
}];

View File

@ -18,24 +18,24 @@ import { Cascader } from 'antd';
const options = [{
value: 'zhejiang',
label: '浙江',
label: 'Zhejiang',
children: [{
value: 'hangzhou',
label: '杭州',
label: 'Hangzhou',
children: [{
value: 'xihu',
label: '西湖',
label: 'West Lake',
}],
}],
}, {
value: 'jiangsu',
label: '江苏',
label: 'Jiangsu',
children: [{
value: 'nanjing',
label: '南京',
label: 'Nanjing',
children: [{
value: 'zhonghuamen',
label: '中华门',
label: 'Zhong Hua Men',
}],
}],
}];
@ -44,7 +44,7 @@ function onChange(value) {
console.log(value);
}
// 只展示最后一项
// Just show the latest item.
function displayRender(label) {
return label[label.length - 1];
}

View File

@ -18,24 +18,24 @@ import { Cascader } from 'antd';
const options = [{
value: 'zhejiang',
label: '浙江',
label: 'Zhejiang',
children: [{
value: 'hangzhou',
label: '杭州',
label: 'Hangzhou',
children: [{
value: 'xihu',
label: '西湖',
label: 'West Lake',
}],
}],
}, {
value: 'jiangsu',
label: '江苏',
label: 'Jiangsu',
children: [{
value: 'nanjing',
label: '南京',
label: 'Nanjing',
children: [{
value: 'zhonghuamen',
label: '中华门',
label: 'Zhong Hua men',
}],
}],
}];
@ -45,6 +45,6 @@ function onChange(value) {
}
ReactDOM.render(
<Cascader options={options} onChange={onChange} placeholder="请选择地区" showSearch />
<Cascader options={options} onChange={onChange} placeholder="Please select" showSearch />
, mountNode);
````

View File

@ -18,24 +18,24 @@ import { Cascader } from 'antd';
const options = [{
value: 'zhejiang',
label: '浙江',
label: 'Zhejiang',
children: [{
value: 'hangzhou',
label: '杭州',
label: 'Hangzhou',
children: [{
value: 'xihu',
label: '西湖',
label: 'West Lake',
}],
}],
}, {
value: 'jiangsu',
label: '江苏',
label: 'Jiangsu',
children: [{
value: 'nanjing',
label: '南京',
label: 'Nanjing',
children: [{
value: 'zhonghuamen',
label: '中华门',
label: 'Zhong Hua Men',
}],
}],
}];