parent
6c13c964c5
commit
72e148cae8
|
@ -1,13 +1,5 @@
|
||||||
import PropTypes from './vue-types';
|
import PropTypes from './vue-types';
|
||||||
import {
|
import { defineComponent, nextTick, onBeforeMount, onUpdated, Teleport, watch } from 'vue';
|
||||||
defineComponent,
|
|
||||||
nextTick,
|
|
||||||
onBeforeMount,
|
|
||||||
onBeforeUnmount,
|
|
||||||
onUpdated,
|
|
||||||
Teleport,
|
|
||||||
watch,
|
|
||||||
} from 'vue';
|
|
||||||
import { useInjectPortal } from '../vc-trigger/context';
|
import { useInjectPortal } from '../vc-trigger/context';
|
||||||
|
|
||||||
export default defineComponent({
|
export default defineComponent({
|
||||||
|
@ -44,11 +36,11 @@ export default defineComponent({
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
onBeforeUnmount(() => {
|
// onBeforeUnmount(() => {
|
||||||
if (container && container.parentNode) {
|
// if (container && container.parentNode) {
|
||||||
container.parentNode.removeChild(container);
|
// container.parentNode.removeChild(container);
|
||||||
}
|
// }
|
||||||
});
|
// });
|
||||||
return () => {
|
return () => {
|
||||||
if (!shouldRender.value) return null;
|
if (!shouldRender.value) return null;
|
||||||
if (isSSR) {
|
if (isSSR) {
|
||||||
|
|
|
@ -61,11 +61,13 @@ export default defineComponent({
|
||||||
const container = shallowRef<HTMLElement>();
|
const container = shallowRef<HTMLElement>();
|
||||||
const componentRef = shallowRef();
|
const componentRef = shallowRef();
|
||||||
const rafId = shallowRef<number>();
|
const rafId = shallowRef<number>();
|
||||||
|
const defaultContainer = canUseDom() && document.createElement('div');
|
||||||
const removeCurrentContainer = () => {
|
const removeCurrentContainer = () => {
|
||||||
// Portal will remove from `parentNode`.
|
// Portal will remove from `parentNode`.
|
||||||
// Let's handle this again to avoid refactor issue.
|
// Let's handle this again to avoid refactor issue.
|
||||||
|
if (container.value === defaultContainer) {
|
||||||
container.value?.parentNode?.removeChild(container.value);
|
container.value?.parentNode?.removeChild(container.value);
|
||||||
|
}
|
||||||
container.value = null;
|
container.value = null;
|
||||||
};
|
};
|
||||||
let parent: HTMLElement = null;
|
let parent: HTMLElement = null;
|
||||||
|
@ -82,8 +84,6 @@ export default defineComponent({
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
// attachToParent();
|
|
||||||
const defaultContainer = canUseDom() && document.createElement('div');
|
|
||||||
const getContainer = () => {
|
const getContainer = () => {
|
||||||
if (!supportDom) {
|
if (!supportDom) {
|
||||||
return null;
|
return null;
|
||||||
|
|
Loading…
Reference in New Issue