Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(message): getContainer prop doesn't work #6942

Merged
merged 1 commit into from
Sep 15, 2023

Conversation

kovsu
Copy link
Member

@kovsu kovsu commented Sep 12, 2023

close: #6937

  1. In the useConfigInject.ts file, add props.getContainer to the return value of getPopupContainer so that we can correctly assign getPopupContainer in useMessage.tsx.

useConfigInject.ts 文件中将 props.getContainer 添加到 getPopupContainer 的返回中,这样我们才能正确的在 useMessage.tsx 中给 getPopupContainer 正确赋值

// useConfigInject.ts
const getPopupContainer = computed(
- () => props.getPopupContainer ?? configProvider.getPopupContainer?.value,
+ () => props.getContainer ?? props.getPopupContainer ?? configProvider.getPopupContainer?.value,
);

// useMessage.tsx
const { getPrefixCls, getPopupContainer } = useConfigInject('message', props);
  1. Attempting to access the DOM elements of the page within the onBeforeMount lifecycle hook returns null. Therefore, this method should be called within the onMounted lifecycle hook.

onBeforeMount 生命周期函数中去获取页面的 DOM 元素,会得到 null,所以应该在 onMounted 生命周期中调用该方法

After:
image

@kovsu kovsu requested a review from tangjinzhou September 12, 2023 03:47
@tangjinzhou tangjinzhou merged commit 2f7f0e6 into vueComponent:main Sep 15, 2023
3 of 4 checks passed
@kovsu kovsu deleted the fix-#6937 branch September 15, 2023 06:23
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Message component's getContainer property doesn't work well
2 participants