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

Message: fix message[type] (#21088)

parent 09e789ba
......@@ -2,6 +2,7 @@ import Vue from 'vue';
import Main from './main.vue';
import { PopupManager } from 'element-ui/src/utils/popup';
import { isVNode } from 'element-ui/src/utils/vdom';
import { isObject } from 'element-ui/src/utils/types';
let MessageConstructor = Vue.extend(Main);
let instance;
......@@ -44,14 +45,17 @@ const Message = function(options) {
};
['success', 'warning', 'info', 'error'].forEach(type => {
Message[type] = options => {
if (typeof options === 'string') {
options = {
message: options
};
Message[type] = (options) => {
if (isObject(options) && !isVNode(options)) {
return Message({
...options,
type
});
}
options.type = type;
return Message(options);
return Message({
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