我想在Vue中使用transition-group,它在没有嵌套\xef\xbc\x8c的情况下工作正常,但是当我像这样使用它时,它的行为很奇怪。
\n然后我在开发者工具中检查动画,发现所有列表项的过渡持续时间实际上为零。
\n\n然后我尝试添加display: block !important样式,但还是不行
\n\n样式中的transitionDelay不会影响结果,我已经尝试过了。
\n并且它可能会突然使用相同的代码正常工作
\n
为了更好理解,这是它的样子(需要用手机或开发工具的移动设备打开,如果是重定向到桌面网站,请更改为移动模式然后刷新)
\n.fade-enter-active,\n.fade-leave-active {\n transition: opacity .3s;\n}\n.fade-enter,\n.fade-leave-active {\n opacity: 0;\n}\n.slide-enter-active,\n.slide-leave-active {\n transition: transform .3s;\n}\n.slide-enter,\n.slide-leave-active {\n transform: translateX(-100%);\n}\n.list-enter-active,\n.list-leave-active {\n transition: all .6s;\n}\n.list-enter,\n.list-leave-active {\n transform: translateX(-350px);\n opacity: 0;\n}Run Code Online (Sandbox Code Playgroud)\r\n<transition name="fade">\n <div class="black-layout" v-show="isShowCatalog">\n <transition name="slide">\n <div v-show="isShowCatalog">\n <transition-group tag="ul" name="list">\n <li v-for="(value, index) of catalog" :key="index + 1" v-show="isShowCatalog" :style="{ transitionDelay: 0.02 * index + \'s\' }" @click="clickCatalog" :data-search="value.searchStr">{{ …Run Code Online (Sandbox Code Playgroud)