In vuejs: how does style dynamically bind background-img add toggle animation?

background picture of timing switching div implemented by my settimeout

<div class="blur1x" :style="{backgroundImage: "url(" + currentImg[currentImgIndex - 1] + ")"}"

I want to add transition animation when switching. Ask the boss for advice.

Mar.30,2021

first of all, background image replacement is not supported for css3 animation

if you want to achieve an effect similar to fade-in and fade-out gradients, you need to change the dom structure. Use as many div as there are pictures, fix them together with absolute positioning, and then use z-index and opacity to achieve animation

.

it is suggested that you can directly achieve your goal by using the Swipe component of the ui framework. If you do not use the ui framework, many


suggest using background-position to control the writing of the broadcast graph, so you can use background to dynamically switch


you can use v-show+vue to transition animation, so you can achieve

.
Menu