Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wanjj_1210
ant-design
提交
51a2798e
A
ant-design
项目概览
wanjj_1210
/
ant-design
与 Fork 源项目一致
从无法访问的项目Fork
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
A
ant-design
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
51a2798e
编写于
11月 24, 2015
作者:
B
Benjy Cui
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: Popconfirm should support i18n
上级
fdd9ef7d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
47 addition
and
24 deletion
+47
-24
components/popconfirm/demo/locale.md
components/popconfirm/demo/locale.md
+17
-0
components/popconfirm/index.jsx
components/popconfirm/index.jsx
+28
-24
components/popconfirm/index.md
components/popconfirm/index.md
+2
-0
未找到文件。
components/popconfirm/demo/locale.md
0 → 100644
浏览文件 @
51a2798e
# 国际化
-
order: 2
设置
`okText`
`cancelText`
以自定义按钮文字。
---
````
jsx
import
{
Popconfirm
}
from
'
antd
'
;
ReactDOM
.
render
(
<
Popconfirm
title
=
"Are you sure?"
okText
=
"Yes"
cancelText
=
"No"
>
<
a
href
=
"javascript:;"
>
Delete
</
a
>
</
Popconfirm
>
,
document
.
getElementById
(
'
components-popconfirm-demo-locale
'
));
````
components/popconfirm/index.jsx
浏览文件 @
51a2798e
...
...
@@ -2,7 +2,23 @@ import React from 'react';
import
Tooltip
from
'
rc-tooltip
'
;
import
Icon
from
'
../icon
'
;
import
Button
from
'
../button
'
;
const
prefixCls
=
'
ant-popover
'
;
const
noop
=
function
()
{};
const
transitionNames
=
{
top
:
'
zoom-down
'
,
bottom
:
'
zoom-up
'
,
left
:
'
zoom-right
'
,
right
:
'
zoom-left
'
,
topLeft
:
'
zoom-down
'
,
bottomLeft
:
'
zoom-up
'
,
leftTop
:
'
zoom-right
'
,
rightTop
:
'
zoom-left
'
,
topRight
:
'
zoom-down
'
,
bottomRight
:
'
zoom-up
'
,
leftBottom
:
'
zoom-right
'
,
rightBottom
:
'
zoom-left
'
,
};
export
default
React
.
createClass
({
getInitialState
()
{
...
...
@@ -16,10 +32,10 @@ export default React.createClass({
placement
:
'
top
'
,
trigger
:
'
click
'
,
overlayStyle
:
{},
onConfirm
:
function
()
{
}
,
o
nCancel
:
function
()
{
}
onConfirm
:
noop
,
onCancel
:
noop
,
o
kText
:
'
确定
'
,
cancelText
:
'
取消
'
};
},
confirm
()
{
...
...
@@ -40,43 +56,31 @@ export default React.createClass({
});
},
render
()
{
const
{
title
,
okText
,
cancelText
,
placement
,
overlayStyle
,
trigger
}
=
this
.
props
;
const
overlay
=
<
div
>
<
div
className
=
{
prefixCls
+
'
-content
'
}
>
<
p
className
=
{
prefixCls
+
'
-message
'
}
>
<
Icon
type
=
"exclamation-circle"
/>
{
t
his
.
props
.
t
itle
}
{
title
}
</
p
>
<
div
className
=
{
prefixCls
+
'
-buttons
'
}
>
<
Button
onClick
=
{
this
.
cancel
}
type
=
"ghost"
size
=
"small"
>
取消
</
Button
>
<
Button
onClick
=
{
this
.
confirm
}
type
=
"primary"
size
=
"small"
>
确定
</
Button
>
<
Button
onClick
=
{
this
.
cancel
}
type
=
"ghost"
size
=
"small"
>
{
cancelText
}
</
Button
>
<
Button
onClick
=
{
this
.
confirm
}
type
=
"primary"
size
=
"small"
>
{
okText
}
</
Button
>
</
div
>
</
div
>
</
div
>;
const
transitionName
=
({
top
:
'
zoom-down
'
,
bottom
:
'
zoom-up
'
,
left
:
'
zoom-right
'
,
right
:
'
zoom-left
'
,
topLeft
:
'
zoom-down
'
,
bottomLeft
:
'
zoom-up
'
,
leftTop
:
'
zoom-right
'
,
rightTop
:
'
zoom-left
'
,
topRight
:
'
zoom-down
'
,
bottomRight
:
'
zoom-up
'
,
leftBottom
:
'
zoom-right
'
,
rightBottom
:
'
zoom-left
'
,
})[
this
.
props
.
placement
];
const
transitionName
=
transitionNames
[
placement
];
return
(
<
Tooltip
placement
=
{
this
.
props
.
placement
}
overlayStyle
=
{
this
.
props
.
overlayStyle
}
<
Tooltip
placement
=
{
placement
}
overlayStyle
=
{
overlayStyle
}
prefixCls
=
{
prefixCls
}
onVisibleChange
=
{
this
.
onVisibleChange
}
transitionName
=
{
transitionName
}
visible
=
{
this
.
state
.
visible
}
trigger
=
{
t
his
.
props
.
t
rigger
}
trigger
=
{
trigger
}
overlay
=
{
overlay
}
>
{
this
.
props
.
children
}
</
Tooltip
>
...
...
components/popconfirm/index.md
浏览文件 @
51a2798e
...
...
@@ -23,3 +23,5 @@
| title | 确认框的描述 | string | 无 |
| onConfirm | 点击确认的回调 | function | 无 |
| onCancel | 卡片内容 | function | 无 |
| okText | 确认按钮文字 | String | 确定 |
| cancelText| 取消按钮文字 | String | 取消 |
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录