diff --git a/packages/message/src/main.js b/packages/message/src/main.js index 95b30aee769..29688b3dd2b 100644 --- a/packages/message/src/main.js +++ b/packages/message/src/main.js @@ -44,14 +44,17 @@ function Message(options) { }; ['success', 'warning', 'info', 'error'].forEach(type => { - Message[type] = options => { - if (typeof options === 'string') { - options = { - message: options - }; + Message[type] = (options) => { + if (options && typeof options === 'object' && !isVNode(options)) { + return Message({ + ...options, + type + }); } - options.type = type; - return Message(options); + return Message({ + type, + message: options + }); }; });