E
E
ERomulon2018-05-22 22:02:37
Vue.js
ERomulon, 2018-05-22 22:02:37

How in Vue to get the page number on which I am and run animations depending on this?

I've already asked a similar question, but it's wrong. Here's the gist: I have a vue app with vue-router. there are 4 components ( Home, About ...). When clicking on vue-router links in the root vue instance, active components are drawn (If you clicked on About, then the About component was drawn, and any functions were worked out to animate any element in the root vue instance). So: how do I bind this component and information, which component from vue-router is currently active? And how to get this information? As an example, a simple pagination on this site on the right in the form of stripes. https://www.ankoku-toshi-jutsu.com/#home

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-05-23
@ERomulon

Set transition's name parameter value depending on the current route:

computed: {
  routeAnimation() {
    return что-то, зависящее от this.$route;
  },
},

<transition :name="routeAnimation">
  <div :key="routeAnimation"></div>
</transition>

https://jsfiddle.net/wac86yo0/1/

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question