Skip to content

Commit 89de910

Browse files
committed
fix: update modal
1 parent 68df93c commit 89de910

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

components/modal/ConfirmDialog.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export default {
6464
{cancelText}
6565
</ActionButton>
6666
);
67-
const iconNode = typeof icon === 'string' ? <Icon type={icon} /> : icon;
67+
const iconNode = typeof icon === 'string' ? <Icon type={icon} /> : icon(h);
6868

6969
return (
7070
<Dialog

components/modal/demo/confirm-router.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,20 +20,20 @@ import Button from '../../button'
2020
export default {
2121
methods: {
2222
showConfirm() {
23+
const _self = this
2324
for (let i = 0; i < 3; i += 1) {
2425
setTimeout(() => {
2526
this.$confirm({
26-
content: (
27-
<Button onClick={this.destroyAll}>
28-
Click to destroy all
29-
</Button>
30-
),
27+
content: 'destroy all',
3128
onOk() {
3229
return new Promise((resolve, reject) => {
3330
setTimeout(Math.random() > 0.5 ? resolve : reject, 1000);
3431
}).catch(() => console.log('Oops errors!'));
3532
},
36-
onCancel() {},
33+
cancelText: 'Click to destroy all',
34+
onCancel() {
35+
_self.destroyAll()
36+
},
3737
});
3838
}, i * 500);
3939
}

components/modal/index.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
11
import Modal, { destroyFns } from './Modal';
22
import modalConfirm from './confirm';
3+
import Icon from '../icon';
34

45
// export { ActionButtonProps } from './ActionButton'
56
// export { ModalProps, ModalFuncProps } from './Modal'
67

78
const info = function(props) {
89
const config = {
910
type: 'info',
10-
icon: <Icon type="info-circle" />,
11+
icon: (h) => {
12+
return <Icon type="info-circle" />;
13+
},
1114
okCancel: false,
1215
...props,
1316
};
@@ -17,7 +20,9 @@ const info = function(props) {
1720
const success = function(props) {
1821
const config = {
1922
type: 'success',
20-
icon: <Icon type="check-circle" />,
23+
icon: (h) => {
24+
return <Icon type="check-circle" />;
25+
},
2126
okCancel: false,
2227
...props,
2328
};
@@ -27,7 +32,9 @@ const success = function(props) {
2732
const error = function(props) {
2833
const config = {
2934
type: 'error',
30-
icon: <Icon type="close-circle" />,
35+
icon: (h) => {
36+
return <Icon type="close-circle" />;
37+
},
3138
okCancel: false,
3239
...props,
3340
};
@@ -37,7 +44,9 @@ const error = function(props) {
3744
const warning = function(props) {
3845
const config = {
3946
type: 'warning',
40-
icon: <Icon type="exclamation-circle" />,
47+
icon: (h) => {
48+
return <Icon type="exclamation-circle" />;
49+
},
4150
okCancel: false,
4251
...props,
4352
};

0 commit comments

Comments
 (0)