Made the animation working again :)

This commit is contained in:
yuanhau 2025-05-18 23:46:14 +08:00
parent 2faaf3941c
commit d9c6cec16e
3 changed files with 29 additions and 12 deletions

View file

@ -33,12 +33,21 @@ const {
const orgNameAnimation = ref(null);
onMounted(() => {
gsap.to(orgNameAnimation.value, {
duration: 1,
scrambleText: fetchNewsOrgInfo.value?.title,
});
});
watch(
() => fetchNewsOrgInfo.value,
(newValue) => {
if (newValue?.title) {
nextTick(() => {
gsap.to(orgNameAnimation.value, {
duration: 1,
scrambleText: newValue.title,
ease: "none",
});
});
}
},
{ immediate: true },
);
</script>
<template>
<div>
@ -52,7 +61,10 @@ onMounted(() => {
draggable="false"
/>
<div class="flex flex-col gap-3 text-left">
<h1 class="text-4xl font-bold m-3 text-left">
<h1
class="text-4xl font-bold m-3 text-left"
ref="orgNameAnimation"
>
{{ fetchNewsOrgInfo?.title }}
</h1>
<span class="text-ms m-1 mt-5 text-left text-wrap">{{

View file

@ -28,9 +28,9 @@ const {
lang: locale,
},
});
if (error) {
if (error === null) {
eerrrroorr.value = true;
errorMsg.value = error.value.message;
errorMsg.value = error.value;
}
async function getImageSource(image: string) {