vue 项目如何使用animate.css
原创
©著作权归作者所有:来自51CTO博客作者wx6332e0803afcf的原创作品,请联系作者获取转载授权,否则将追究法律责任
一 、安装
在命令行中执行:
使用npm或者cnpm安装
npm install animate.css --save 或 cnpm install animate.css --save
使用yarn安装
二、引入
在main.js全局引入
import animated from ‘animate.css‘
vue.use(animated)
三、页面使用
类名(animated )需要和引入的名称相同,bounceInLeft是需要的动画效果
<transition enter-active- leave-active->
<div v-show="tofalse"></div>
</transition>
四、踩坑问题
如果完成前三部还是没有效果,可能就是animate.css版本的问题了,直接安装的都是最新版本,而vue官网引入的是3.5.1版本。更换一下版本:
先卸载:
npm或cnpm卸载:
npm uninstall animate.css --save
cnpm uninstall animate.css --save
或者 yarn卸载:
重新安装:
npm或cnpm安装:
npm install animate.css@3.5.1 --save
cnpm install animate.css@3.5.1 --save
yarn安装:
yarn add animate.css@3.5.1
应该就木有问题了。
本文完〜