Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
wanjj_1210
ant-design
提交
f7176f31
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,发现更多精彩内容 >>
提交
f7176f31
编写于
11月 23, 2015
作者:
J
jljsj
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'badge-anim' of github.com:ant-design/ant-design into badge-anim
上级
23b5bf0c
25083637
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
20 addition
and
15 deletion
+20
-15
components/badge/AntNumber.jsx
components/badge/AntNumber.jsx
+11
-8
components/badge/demo/change.md
components/badge/demo/change.md
+8
-4
components/badge/index.jsx
components/badge/index.jsx
+1
-3
未找到文件。
components/badge/AntNumber.jsx
浏览文件 @
f7176f31
import
React
,
{
createElement
}
from
'
react
'
;
import
{
findDOMNode
}
from
'
react-dom
'
;
import
{
toArrayChildren
,
getPartNumber
,
getTranslateY
}
from
'
./utils
'
;
import
React
,
{
createElement
}
from
'
react
'
;
import
{
findDOMNode
}
from
'
react-dom
'
;
import
{
toArrayChildren
,
getPartNumber
,
getTranslateY
}
from
'
./utils
'
;
import
assign
from
'
object-assign
'
;
class
AntNumber
extends
React
.
Component
{
...
...
@@ -16,15 +16,17 @@ class AntNumber extends React.Component {
};
}
getNumberOnly
(
c
,
style
)
{
getNumberOnly
(
index
,
style
)
{
const
childrenToReturn
=
[];
for
(
let
i
=
0
;
i
<
30
;
i
++
)
{
let
count
=
i
>=
10
?
i
%
10
:
i
;
const
children
=
<
p
key
=
{
i
}
>
{
count
}
</
p
>;
childrenToReturn
.
push
(
children
);
childrenToReturn
.
push
(<
p
key
=
{
i
}
>
{
count
}
</
p
>);
}
const
key
=
'
only_
'
+
c
;
return
createElement
(
'
span
'
,
{
className
:
`
${
this
.
props
.
prefixCls
}
-only`
,
style
:
style
,
key
:
key
},
childrenToReturn
);
return
createElement
(
'
span
'
,
{
className
:
`
${
this
.
props
.
prefixCls
}
-only`
,
style
:
style
,
key
:
index
,
},
childrenToReturn
);
}
setEndState
(
style
)
{
...
...
@@ -108,6 +110,7 @@ class AntNumber extends React.Component {
return
createElement
(
this
.
props
.
component
,
props
,
childrenToRender
);
}
}
AntNumber
.
defaultProps
=
{
prefixCls
:
'
ant-number
'
,
count
:
null
,
...
...
components/badge/demo/change.md
浏览文件 @
f7176f31
...
...
@@ -33,7 +33,7 @@ const Test = React.createClass({
show
:
!
this
.
state
.
show
});
},
onNumberClick
(){
onNumberClick
()
{
const
count
=
this
.
state
.
count
;
this
.
setState
({
count
:
count
?
0
:
5
...
...
@@ -45,9 +45,15 @@ const Test = React.createClass({
<
a
href
=
"#"
className
=
"head-example"
></
a
>
</
Badge
>
<
Badge
dot
=
{
this
.
state
.
show
}
>
<
a
href
=
"#"
>
一个链接
</
a
>
<
a
href
=
"#"
className
=
"head-example"
>
</
a
>
</
Badge
>
<
div
style
=
{
{
marginTop
:
10
}
}
>
<
Button
type
=
"ghost"
onClick
=
{
this
.
onNumberClick
}
style
=
{
{
marginRight
:
6
}
}
>
切换数字显隐
</
Button
>
<
Button
type
=
"ghost"
onClick
=
{
this
.
onClick
}
style
=
{
{
marginRight
:
6
}
}
>
切换红点显隐
</
Button
>
<
ButtonGroup
>
<
Button
type
=
"ghost"
onClick
=
{
this
.
decline
}
>
<
Icon
type
=
"minus"
/>
...
...
@@ -56,8 +62,6 @@ const Test = React.createClass({
<
Icon
type
=
"plus"
/>
</
Button
>
</
ButtonGroup
>
<
Button
type
=
"ghost"
onClick
=
{
this
.
onClick
}
style
=
{
{
marginLeft
:
10
}
}
>
点切换
</
Button
>
<
Button
type
=
"ghost"
onClick
=
{
this
.
onNumberClick
}
style
=
{
{
marginLeft
:
10
}
}
>
数字切换
</
Button
>
</
div
>
</
div
>;
}
...
...
components/badge/index.jsx
浏览文件 @
f7176f31
...
...
@@ -31,7 +31,7 @@ class AntBadge extends React.Component {
transitionAppear
=
{
true
}
>
{
hidden
?
null
:
<
AntNumber
data
-
show
=
{
!
hidden
}
className
=
{
className
}
count
=
{
count
}
callback
=
{
this
.
props
.
animEnd
}
/>
<
AntNumber
data
-
show
=
{
!
hidden
}
className
=
{
className
}
count
=
{
count
}
/>
}
</
Animate
>
</
span
>
...
...
@@ -43,7 +43,6 @@ AntBadge.defaultProps = {
prefixCls
:
'
ant-badge
'
,
count
:
null
,
dot
:
false
,
animEnd
:
null
};
AntBadge
.
propTypes
=
{
...
...
@@ -52,7 +51,6 @@ AntBadge.propTypes = {
React
.
PropTypes
.
number
]),
dot
:
React
.
PropTypes
.
bool
,
animEnd
:
React
.
PropTypes
.
func
};
export
default
AntBadge
;
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录