update modal

pull/6/head
yiminghe 10 years ago
parent 7e4fcfed27
commit d3823e95d2

@ -16,8 +16,9 @@ function show() {
onCancel: function() {
alert('cancel');
},
onOk: function() {
onOk: function(close) {
alert('ok');
setTimeout(close,100);
}
});
}

@ -21,18 +21,22 @@ module.exports = function (props) {
if (props.onCancel) {
props.onCancel();
}
close();
}
function close() {
d.setState({
visible: false
});
}
function onOk() {
if (props.onOk) {
props.onOk();
var onOk = props.onOk;
if (onOk) {
onOk(close);
} else {
close();
}
d.setState({
visible: false
});
}
var footer = [
@ -46,6 +50,8 @@ module.exports = function (props) {
props.visible = true;
props.children = props.content;
props.footer = footer;
var d = React.render(<Dialog {...props}/>, div);
return d;
var d;
React.render(<Dialog {...props}/>, div, function () {
d = this;
});
};

Loading…
Cancel
Save