File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ import Vue from 'vue';
2
2
import Main from './main.vue' ;
3
3
import { PopupManager } from 'element-ui/src/utils/popup' ;
4
4
import { isVNode } from 'element-ui/src/utils/vdom' ;
5
+ import { isObject } from 'element-ui/src/utils/types' ;
5
6
let MessageConstructor = Vue . extend ( Main ) ;
6
7
7
8
let instance ;
@@ -44,14 +45,17 @@ const Message = function(options) {
44
45
} ;
45
46
46
47
[ 'success' , 'warning' , 'info' , 'error' ] . forEach ( type => {
47
- Message [ type ] = options => {
48
- if ( typeof options === 'string' ) {
49
- options = {
50
- message : options
51
- } ;
48
+ Message [ type ] = ( options ) => {
49
+ if ( isObject ( options ) && ! isVNode ( options ) ) {
50
+ return Message ( {
51
+ ...options ,
52
+ type
53
+ } ) ;
52
54
}
53
- options . type = type ;
54
- return Message ( options ) ;
55
+ return Message ( {
56
+ type,
57
+ message : options
58
+ } ) ;
55
59
} ;
56
60
} ) ;
57
61
You can’t perform that action at this time.
0 commit comments