transition-group列表过渡

# transition-group列表过渡

# 列表的进入/离开过渡

<transition-group tag="ul"> <!--tag转为ul-->
    <li v-for="item in list" :key="item">{{item}}</li> <!--子元素要有key-->
</transition-group>
1
2
3

注意:列表元素一定要有key

.v-enter,.v-leave-to{
  opacity: 0;
  transform: translateX(30px);
}
.v-enter-active,.v-leave-active{
  transition: all 1s;
}
1
2
3
4
5
6
7

See the Pen vue列表过渡 by xugaoyi (@xugaoyi) on CodePen.

# 列表的排序过渡

.v-move {
  transition: transform 1s;
}
1
2
3

See the Pen vue列表过渡-排序过渡 by xugaoyi (@xugaoyi) on CodePen.

列表过渡&排序过渡

See the Pen vue列表过渡&排序过渡 by xugaoyi (@xugaoyi) on CodePen.

上次更新: 2025/02/10, 20:20:37
最近更新
01
Git问题集合
01-29
02
安装 Nginx 服务器
01-25
03
安装 Docker 容器
01-25
更多文章>
×
×