update modal

This commit is contained in:
yiminghe
2015-06-05 12:05:52 +08:00
parent 7e4fcfed27
commit d3823e95d2
2 changed files with 15 additions and 8 deletions
+2 -1
View File
@@ -16,8 +16,9 @@ function show() {
onCancel: function() {
alert('cancel');
},
onOk: function() {
onOk: function(close) {
alert('ok');
setTimeout(close,100);
}
});
}
+13 -7
View File
@@ -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;
});
};