如何将 animate.css 添加到 nuxt js 应用程序?

Kib*_*ian 2 css animate.css vue.js nuxt.js

如何安装 animate.css 并使其在我的 nuxtjs 项目中运行?我尝试过使用animate.css 安装指南,但仍然不起作用。

Kib*_*ian 6

对于 npm 用户,使用此命令在您的项目中添加 animate.css npm i animate.css --save

对于纱线用户 yarn add animate.css

然后将 animate.css 添加到您的nuxt.config.js文件中

export default {
  // ...
  css: ['animate.css/animate.min.css'] 
  // ...
}
Run Code Online (Sandbox Code Playgroud)

然后像这样在 HTML 中使用它

<h1 class="animate__animated animate__bounce">
  An animated element
</h1>
Run Code Online (Sandbox Code Playgroud)