I have made an one-time dynamic effect, and there is no way to change it back to recycling. I read the official vue documentation and couldn"t find the method I wanted.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
@keyframes one {
0% {
width: 100px;
background: red;
}
100% {
width: 0px;
background: red;
}
}
@keyframes two {
0% {
width: 100px;
background: red;
}
100% {
width: 100px;
background: red;
-webkit-transform: rotate(135deg);
}
}
@keyframes three {
0% {
width: 100px;
background: red;
}
100% {
width: 100px;
background: red;
transform: rotate(45deg) translate(-28px,-28px);
/* -webkit-transform-origin: center; */
/* -webkit-transform: translate(50px,100px); */
}
}
.line {
margin-top: 20px;
width: 100px;
height: 20px;
background: red;
color: -sharpfff;
border-radius: 8px;
}
.box {
display: flex;
flex-direction: column;
width:100px;
}
.one {
animation: one 1s ease .1s forwards;
}
.two {
animation: two 1s ease .1s forwards;
}
.three {
animation: three 1s ease .1s forwards;
}
</style>
</head>
<body>
<div name="close" class="box" @click="change">
<div :class="line1"></div>
<div :class="line2"></div>
<div :class="line3"></div>
</div>
<script src="https://cdn.jsdelivr.net/npm/vue@2.5.16/dist/vue.js"></script>
<script>
new Vue({
el: ".box",
data: {
line1: "line",
line2: "line",
line3: "line",
},
methods: {
change() {
this.line1 = "line one";
this.line2 = "line two";
this.line3 = "line three";
}
}
})
</script>
</body>
</html>
how to use
v-enter
v-enter-active
v-enter-to
v-leave
v-leave-active
v-leave-to
to implement