|
|
@ -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; |
|
|
|