Home > Web Front-end > JS Tutorial > body text

Vue.js uses transition animation to create route jump animation

php中世界最好的语言
Release: 2018-03-13 14:46:14
Original
3591 people have browsed it

This time I will bring you how to use transition animation in Vue.js animation to make routing jump animation, and Vue.js to use transition animation to make route jump animation Precautions What are they? The following is a practical case. Let’s take a look.

keep-live: The switched view will be cached. If keep-live is not added, it will be re-requested every time, which consumes more resources

<transition name="fade">
   <keep-alive>
      <router-view></router-view>
   </keep-alive></transition>
Copy after login

Note:

When we switch navigation, the class of the current link tag will be assigned class="router-link-active", which is a very useful operation.

Add active-class="active" to router-link to modify the style

<ul>
    <router-link v-for="item in products" :to="{ path: item.path }" tag="li" active-class="active">
     {{ item.name }}    </router-link></ul>css部分
选种和hover时,显示蓝色
.product-board li.active,
.product-board li:hover {
  background: #4fc08d;
  color: #fff;
}
......
Copy after login

The keep-alive attribute of router-view ensures that the view is only rendered once, and switching back and forth does not render repeatedly


Vue.js uses transition animation to create route jump animation

I believe I read the case in this article You have mastered the method. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Other operations of Vue.js routing

Nested routing (sub-routing) of Vue.js )

Vue.js’s custom directive directive

The above is the detailed content of Vue.js uses transition animation to create route jump animation. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!