fix(components): [message] set appentTo value (#8730)

* fix(components): [message] set appentTo value

* feat: update judge
This commit is contained in:
btea 2022-07-15 23:17:28 +08:00 committed by GitHub
parent 3d96c878bf
commit e6e6842805
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -41,7 +41,9 @@ const normalizeOptions = (params?: MessageParams) => {
...options, ...options,
} }
if (isString(normalized.appendTo)) { if (!normalized.appendTo) {
normalized.appendTo = document.body
} else if (isString(normalized.appendTo)) {
let appendTo = document.querySelector<HTMLElement>(normalized.appendTo) let appendTo = document.querySelector<HTMLElement>(normalized.appendTo)
// should fallback to default value with a warning // should fallback to default value with a warning