[Vuejs]-Vue element class transition

0👍

Why not bind classes to a specific condition (see Vue documentation https://v2.vuejs.org/v2/guide/class-and-style.html) and then use the transition-property in CSS (https://www.w3schools.com/css/css3_transitions.asp)?

👤Bene

0👍

Solved it by adding transition: background-image 2s; at the top of every css class before the background-image.

👤xvy.

0👍

when you change class in your dom and need transition , must do like this


<div :class="{active: true}" ></div>


div {
 background-color:red;
 transition:all 2s ease;
}

.active {

background-color: red;

}


Leave a comment