LoginSignup
1
0

More than 1 year has passed since last update.

NuxtLinkのページ遷移で今見ているページをフェードアウトさせたい。

Last updated at Posted at 2021-12-22

最近よく見るページ遷移する際に今見ているページをフェードアウトやつ
あれをNuxtLinkとGSAPでやろうとした際の備忘録。
NuxtLinkのページ遷移をpreventするのにはどうすればよいかわかりませんでしたが、
参考リンクがとても参考になりました。
SEO的にはどうなるのでしょうか、わかりません。

page.vue
<NuxtLink to="/page2" event="" @click.native="link">
 page2
</NuxtLink>

page.vue
methods: {
    link (e) {
      e.preventDefault()
      gsap.to('#loading', {
        opacity: 1,
        width: '100%',
        height: '100%',
        duration: 1
      })
      setTimeout(() => {
        this.$router.push({ path: e.target.attributes[1].nodeValue })
      }, 1000)
    }
}

参考リンク
https://qiita.com/1994spagetian/items/be1de1189a3a31147805

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0