fix: setContainer in onBeforeMount for drawer (#6986)
* fix: setContainer in onBeforeMount for drawer * fix: add judgementpull/7025/head
parent
4428423be4
commit
449adb03df
|
@ -23,14 +23,24 @@ export default defineComponent({
|
||||||
// getContainer 不会改变,不用响应式
|
// getContainer 不会改变,不用响应式
|
||||||
let container: HTMLElement;
|
let container: HTMLElement;
|
||||||
const { shouldRender } = useInjectPortal();
|
const { shouldRender } = useInjectPortal();
|
||||||
onBeforeMount(() => {
|
|
||||||
isSSR = false;
|
function setContainer() {
|
||||||
});
|
|
||||||
onMounted(() => {
|
|
||||||
if (shouldRender.value) {
|
if (shouldRender.value) {
|
||||||
container = props.getContainer();
|
container = props.getContainer();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
isSSR = false;
|
||||||
|
// drawer
|
||||||
|
setContainer();
|
||||||
});
|
});
|
||||||
|
onMounted(() => {
|
||||||
|
if (container) return;
|
||||||
|
// https://github.com/vueComponent/ant-design-vue/issues/6937
|
||||||
|
setContainer();
|
||||||
|
});
|
||||||
|
|
||||||
const stopWatch = watch(shouldRender, () => {
|
const stopWatch = watch(shouldRender, () => {
|
||||||
if (shouldRender.value && !container) {
|
if (shouldRender.value && !container) {
|
||||||
container = props.getContainer();
|
container = props.getContainer();
|
||||||
|
|
|
@ -90,8 +90,7 @@ const Holder = defineComponent({
|
||||||
closable: false,
|
closable: false,
|
||||||
closeIcon: mergedCloseIcon,
|
closeIcon: mergedCloseIcon,
|
||||||
duration: props.duration ?? DEFAULT_DURATION,
|
duration: props.duration ?? DEFAULT_DURATION,
|
||||||
getContainer: () =>
|
getContainer: props.staticGetContainer ?? getPopupContainer.value,
|
||||||
props.staticGetContainer?.() || getPopupContainer.value?.() || document.body,
|
|
||||||
maxCount: props.maxCount,
|
maxCount: props.maxCount,
|
||||||
onAllRemoved: props.onAllRemoved,
|
onAllRemoved: props.onAllRemoved,
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue