[Vuejs]-Why anime.js doesn't work on a click in vuejs?

0👍

I found the answer to my question.

<template>
  <div class="compHeader">
    <h1 ref="animeEl">hello, world!!</h1>
    <button @click="anime.restart()">click me</button>
  </div>
</template>
<script>
data: () => ({
  anime: null,
}),
mounted() {
  this.anime = this.$anime({
    targets: this.$refs.animeEl,
    translateX: 200,
    delay: 800,
  });
}
</script>

Leave a comment