From 970aa4f84634c5ab4fe9a7c4c83dc9f2d8e3f912 Mon Sep 17 00:00:00 2001 From: afc163 Date: Thu, 20 Aug 2015 13:17:17 +0800 Subject: [PATCH] Update code style --- components/alert/index.jsx | 17 +++++++---------- package.json | 2 +- style/components/alert.less | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/components/alert/index.jsx b/components/alert/index.jsx index 478dda5f79..525b127561 100644 --- a/components/alert/index.jsx +++ b/components/alert/index.jsx @@ -1,5 +1,4 @@ import React from 'react'; -import { animationEndEvent, addEventListenerOnce } from '../util/index'; import Animate from 'rc-animate'; export default React.createClass({ @@ -16,10 +15,9 @@ export default React.createClass({ }, handleClose(e) { let dom = React.findDOMNode(this); - dom.style.height = dom.offsetHeight + 'px'; // Magic code - // 重复是去除浏览器渲染bug; + // 重复一次后才能正确设置 height dom.style.height = dom.offsetHeight + 'px'; this.setState({ @@ -29,7 +27,7 @@ export default React.createClass({ this.props.onClose.call(this, e); } }, - animationEnd(){ + animationEnd() { this.setState({ closed: true, closing: true @@ -58,8 +56,7 @@ export default React.createClass({ if (this.props.description) { let close = this.props.closable ? - + : ''; html =
@@ -82,16 +79,16 @@ export default React.createClass({ html =
{this.props.message} - {close} + {close}
; } } - return !this.state.closed ? - {html} - : null; + {html} + ; } }); diff --git a/package.json b/package.json index 73c6f598a4..2e949b453b 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "rc-util": "~2.0.3", "react-slick2": "~0.6.6", "reqwest": "~2.0.1", - "rc-animate": "^1.1.0" + "rc-animate": "~1.1.0" }, "devDependencies": { "autoprefixer-loader": "~2.0.0", diff --git a/style/components/alert.less b/style/components/alert.less index 14de15ff41..118cfefa74 100644 --- a/style/components/alert.less +++ b/style/components/alert.less @@ -153,7 +153,7 @@ } } - &-close{ + &-close { height: 0 !important; opacity: 0 !important; margin: 0;