[new feature] Toast: add get-container prop (#2724)

This commit is contained in:
neverland
2019-02-12 19:39:45 +08:00
committed by GitHub
parent c778a50cd4
commit ba811b50b0
4 changed files with 18 additions and 11 deletions
+10 -6
View File
@@ -140,18 +140,22 @@ export default {
move() {
let container;
const { getContainer } = this;
if (getContainer) {
container =
typeof getContainer === 'string'
? document.querySelector(getContainer)
: getContainer();
if (typeof getContainer === 'string') {
container =
getContainer === 'body'
? document.body
: document.querySelector(getContainer);
} else {
container = getContainer();
}
} else if (this.$parent) {
container = this.$parent.$el;
}
if (container) {
if (container && container !== this.$el.parentNode) {
container.appendChild(this.$el);
}
},