fix: hook warning, close #7281 #7273 #7274

pull/7302/head
tangjinzhou 2024-01-16 20:34:11 +08:00
parent 1e07544e74
commit c717473568
1 changed files with 4 additions and 4 deletions

View File

@ -1,5 +1,5 @@
import type { CSSProperties } from 'vue'; import type { CSSProperties } from 'vue';
import { shallowRef, watch, computed } from 'vue'; import { shallowRef, watch } from 'vue';
import HookNotification, { getUuid } from './HookNotification'; import HookNotification, { getUuid } from './HookNotification';
import type { NotificationInstance, OpenConfig, Placement } from './Notification'; import type { NotificationInstance, OpenConfig, Placement } from './Notification';
import type { CSSMotionProps } from '../_util/transition'; import type { CSSMotionProps } from '../_util/transition';
@ -116,7 +116,7 @@ export default function useNotification(rootConfig: NotificationConfig = {}) {
notices.value = []; notices.value = [];
}; };
const contextHolder = computed(() => ( const contextHolder = () => (
<HookNotification <HookNotification
ref={notificationsRef} ref={notificationsRef}
prefixCls={prefixCls} prefixCls={prefixCls}
@ -130,7 +130,7 @@ export default function useNotification(rootConfig: NotificationConfig = {}) {
onAllRemoved={onAllRemoved} onAllRemoved={onAllRemoved}
getContainer={getContainer} getContainer={getContainer}
></HookNotification> ></HookNotification>
)); );
const taskQueue = shallowRef([] as Task[]); const taskQueue = shallowRef([] as Task[]);
// ========================= Refs ========================= // ========================= Refs =========================
@ -178,5 +178,5 @@ export default function useNotification(rootConfig: NotificationConfig = {}) {
}); });
// ======================== Return ======================== // ======================== Return ========================
return [api, () => contextHolder.value] as const; return [api, contextHolder] as const;
} }