mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-02 03:59:01 +08:00
pass lint
This commit is contained in:
parent
81d61868b2
commit
3690b2888d
@ -1,3 +1,5 @@
|
||||
'use strict';
|
||||
|
||||
var React = require('react');
|
||||
var Dialog = require('rc-dialog');
|
||||
var div;
|
||||
@ -17,26 +19,38 @@ module.exports = function (props) {
|
||||
}
|
||||
|
||||
function onCancel() {
|
||||
if (props.onCancel) {
|
||||
props.onCancel(close);
|
||||
var cancelFn = props.onCancel;
|
||||
if (cancelFn) {
|
||||
if(cancelFn.length){
|
||||
cancelFn(close);
|
||||
}else {
|
||||
cancelFn();
|
||||
close();
|
||||
}
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
function onOk() {
|
||||
if (props.onOk) {
|
||||
props.onOk(close);
|
||||
var okFn = props.onOk;
|
||||
if (okFn) {
|
||||
if(okFn.length){
|
||||
okFn(close);
|
||||
}else {
|
||||
okFn();
|
||||
close();
|
||||
}
|
||||
} else {
|
||||
close();
|
||||
}
|
||||
}
|
||||
|
||||
var body = <div className="ant-confirm-body">
|
||||
<i className={"anticon " + props.iconClassName}></i>
|
||||
<i className={'anticon ' + props.iconClassName}></i>
|
||||
<span className="ant-confirm-title">{props.title}</span>
|
||||
<div className="ant-confirm-content">{props.content}</div>
|
||||
</div>
|
||||
</div>;
|
||||
var footer = <div className="ant-confirm-btns">
|
||||
<button type="button" className="ant-btn-default ant-btn ant-btn-lg" onClick={onCancel}>取 消</button>
|
||||
<button type="button" className="ant-btn-primary ant-btn ant-btn-lg" onClick={onOk}>确 定</button>
|
||||
@ -48,7 +62,7 @@ module.exports = function (props) {
|
||||
}
|
||||
|
||||
React.render(<Dialog className="ant-confirm" renderToBody={false} visible={true} closable={false} title="" animation="zoom" maskAnimation="fade" width={width}>
|
||||
<div style={{zoom:1,overflow:'hidden'}}>{body} {footer}</div>
|
||||
<div style={{zoom: 1, overflow: 'hidden'}}>{body} {footer}</div>
|
||||
|
||||
</Dialog>, div, function () {
|
||||
d = this;
|
||||
|
@ -2,18 +2,19 @@
|
||||
|
||||
var React = require('react');
|
||||
var Dialog = require('rc-dialog');
|
||||
function noop(){}
|
||||
function noop() {
|
||||
}
|
||||
|
||||
var Modal = React.createClass({
|
||||
handleCancel() {
|
||||
this.refs.d.requestClose();
|
||||
},
|
||||
|
||||
getDefaultProps(){
|
||||
getDefaultProps() {
|
||||
return {
|
||||
onOk:noop,
|
||||
onCancel:noop,
|
||||
onBeforeClose:noop
|
||||
onOk: noop,
|
||||
onCancel: noop,
|
||||
onBeforeClose: noop
|
||||
};
|
||||
},
|
||||
|
||||
@ -27,8 +28,8 @@ var Modal = React.createClass({
|
||||
<button type="button" className="ant-btn-default ant-btn" onClick={this.handleCancel}>取 消</button>,
|
||||
<button type="button" className="ant-btn-primary ant-btn" onClick={this.handleOk}>确 定</button>
|
||||
];
|
||||
return <Dialog animation="zoom" maskAnimation="fade" width="500" footer={footer} {...props} ref="d"/>
|
||||
return <Dialog animation="zoom" maskAnimation="fade" width="500" footer={footer} {...props} ref="d"/>;
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = Modal;
|
||||
module.exports = Modal;
|
||||
|
2
index.js
2
index.js
@ -9,7 +9,7 @@ var antd = {
|
||||
Dropdown: require('./components/dropdown'),
|
||||
Progress: require('./components/progress'),
|
||||
Select: require('./components/select'),
|
||||
confirm:require('./components/confirm')
|
||||
confirm: require('./components/confirm')
|
||||
};
|
||||
|
||||
module.exports = window.antd = antd;
|
||||
|
@ -32,11 +32,13 @@
|
||||
"eslint-plugin-react": "~2.5.0",
|
||||
"extract-text-webpack-plugin": "~0.8.1",
|
||||
"gh-pages-cli": "~0.2.0",
|
||||
"jshint": "~2.8.0",
|
||||
"json-loader": "~0.5.1",
|
||||
"less": "~2.5.1",
|
||||
"less-loader": "~2.2.0",
|
||||
"lodash": "~3.8.0",
|
||||
"nico-jsx": "~0.5.8",
|
||||
"precommit-hook": "~1.0.7",
|
||||
"style-loader": "~0.12.2",
|
||||
"webpack": "~1.9.7"
|
||||
},
|
||||
@ -47,5 +49,8 @@
|
||||
"deploy": "npm run build && gh-pages -d _site -b gh-pages",
|
||||
"lint": "eslint components index.js --ext '.js,.jsx'",
|
||||
"test": "webpack && npm run lint"
|
||||
}
|
||||
},
|
||||
"precommit": [
|
||||
"lint"
|
||||
]
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user