From 6a7b411b93b2f1378ed0da9639554e85f3c92662 Mon Sep 17 00:00:00 2001 From: thepaperpilot Date: Sat, 9 Jul 2022 18:42:16 -0500 Subject: [PATCH] Add notif component --- src/components/Node.vue | 21 +++++++++----------- src/components/Notif.vue | 42 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 12 deletions(-) create mode 100644 src/components/Notif.vue diff --git a/src/components/Node.vue b/src/components/Node.vue index e1686e3..4e61363 100644 --- a/src/components/Node.vue +++ b/src/components/Node.vue @@ -17,24 +17,21 @@ const unregister = inject(UnregisterNodeInjectionKey, () => {}); const node = ref(null); const parentNode = computed(() => node.value && node.value.parentElement); -if (register && unregister) { - watch([parentNode, props.id], ([newNode, newID], [prevNode, prevID]) => { - if (prevNode) { - unregister(unref(prevID)); - } - if (newNode) { - register(newID, newNode); - } - }); +watch([parentNode, props.id], ([newNode, newID], [prevNode, prevID]) => { + if (prevNode) { + unregister(unref(prevID)); + } + if (newNode) { + register(newID, newNode); + } +}); - onUnmounted(() => unregister(unref(props.id))); -} +onUnmounted(() => unregister(unref(props.id)));