Commit 1ef72a32 authored by 好多大米's avatar 好多大米 Committed by GitHub

Message: fix message[type] (#21088)

parent 09e789ba
...@@ -2,6 +2,7 @@ import Vue from 'vue'; ...@@ -2,6 +2,7 @@ import Vue from 'vue';
import Main from './main.vue'; import Main from './main.vue';
import { PopupManager } from 'element-ui/src/utils/popup'; import { PopupManager } from 'element-ui/src/utils/popup';
import { isVNode } from 'element-ui/src/utils/vdom'; import { isVNode } from 'element-ui/src/utils/vdom';
import { isObject } from 'element-ui/src/utils/types';
let MessageConstructor = Vue.extend(Main); let MessageConstructor = Vue.extend(Main);
let instance; let instance;
...@@ -44,14 +45,17 @@ const Message = function(options) { ...@@ -44,14 +45,17 @@ const Message = function(options) {
}; };
['success', 'warning', 'info', 'error'].forEach(type => { ['success', 'warning', 'info', 'error'].forEach(type => {
Message[type] = options => { Message[type] = (options) => {
if (typeof options === 'string') { if (isObject(options) && !isVNode(options)) {
options = { return Message({
message: options ...options,
}; type
});
} }
options.type = type; return Message({
return Message(options); type,
message: options
});
}; };
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment