前言:animate.css没反应多半的版本问题
昨天 在vue3中正常的安装使用animate.css,
cnpm install animate.css --save
引入
import animated from 'animate.css'
Vue.use(animated)
使用
<transition name="fade"
enter-active-class="animated bounce"
leave-active-class="animated shake">
<div class=" diary-item wow animated"
:class="{ 'bounceOutLeft':isAnimate}"
@click="itemClick"
></div>
</transition>
这是跟着各类博客和animate.css 的中文文档一步一步操作的 ,
但是一点效果都没有 搞的我有的小头疼疼, 然后放了放,
今天新建html小Dom测试 ,根据昨天的博客资料操作 一样没有效果,然后自己 读了一下仔细读了一下官方文档,发现了下面这个小东西:
重新在html小Dom和vue中测试了一下 ,有用了 ,开心。
反思:
大部分博客和animate.css中文文档用的都是 v3 的版本,animate.css官方文档主介绍的是最新版本,现在已经是 v4版本。
vue默认安装的是最新的vue4版本,所以使用是要加animate_ 前缀,例如:
<div class=" diary-item wow"
:class="{ 'animate__animated animate__bounceOutLeft':isAnimate}"
@click="itemClick"
></div>
总结:
- animate.css v3版本添加类名不加后缀
- v4版本添加类名要加animate_后缀,否则没有效果
- vue3 npm i animate.css 默认安装的是v4版本
- 多看官方文档,官方才是硬道理,一手资讯