|
@@ -1,5 +1,5 @@
|
|
|
<template>
|
|
<template>
|
|
|
- <section class="title--visual" :data-theme="theme">
|
|
|
|
|
|
|
+ <section class="title--visual" :data-theme="theme" ref="titleVisualRef">
|
|
|
<div class="title--visual--wrapper">
|
|
<div class="title--visual--wrapper">
|
|
|
<div
|
|
<div
|
|
|
class="title--visual--content"
|
|
class="title--visual--content"
|
|
@@ -55,6 +55,7 @@
|
|
|
import { onMounted, ref } from "vue";
|
|
import { onMounted, ref } from "vue";
|
|
|
|
|
|
|
|
const isVisible = ref(false);
|
|
const isVisible = ref(false);
|
|
|
|
|
+ const titleVisualRef = ref(null);
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
|
if (props.animation) {
|
|
if (props.animation) {
|
|
@@ -75,15 +76,15 @@
|
|
|
}
|
|
}
|
|
|
);
|
|
);
|
|
|
|
|
|
|
|
- const element = document.querySelector(".title--visual");
|
|
|
|
|
- if (element) {
|
|
|
|
|
- observer.observe(element);
|
|
|
|
|
|
|
+ // ref를 통해 현재 컴포넌트 요소만 선택
|
|
|
|
|
+ if (titleVisualRef.value) {
|
|
|
|
|
+ observer.observe(titleVisualRef.value);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// cleanup
|
|
// cleanup
|
|
|
return () => {
|
|
return () => {
|
|
|
- if (element) {
|
|
|
|
|
- observer.unobserve(element);
|
|
|
|
|
|
|
+ if (titleVisualRef.value) {
|
|
|
|
|
+ observer.unobserve(titleVisualRef.value);
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|
|
|
} else {
|
|
} else {
|