feat: add methods for message type (#594)

This commit is contained in:
BeADre 2020-11-17 09:44:44 +08:00 committed by GitHub
parent 3c1fda6fbb
commit 533638dd1a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -107,5 +107,17 @@ export function closeAll(): void {
}
}
['success', 'warning', 'info', 'error'].forEach(type => {
Message[type] = (options = {}) => {
if (typeof options === 'string') {
options = {
message: options,
type,
}
}
return Message(options)
}
})
Message.closeAll = closeAll
export default Message