美文网首页
vue中使用animate.css并为路由添加过渡

vue中使用animate.css并为路由添加过渡

作者: 丶维她命 | 来源:发表于2020-03-02 11:49 被阅读0次

    1. 安装依赖

    npm install animate.css --save
    

    2. 安装加载器

    npm install css-loader --save-dev
    npm install vue-style-loader --save-dev
    

    3. webpack.config.js配置

    module.exports = {
      module: {
        rules: [
          {
            test: /\.css$/,
            use: [ 'vue-style-loader', 'css-loader' ]
          }
        ]
      }
    }
    

    4. 在app.vue的style标签里引入animate.css

    <style>
    @import '~animate.css';
    </style>
    

    插入animate.css成功后...

    为路由添加过渡并使用animate.css

    <div id='app'>
          <transition
          name="bounce"
          enter-active-class="animated bounceInLeft"
          leave-active-class="animated bounceOutRight"
        >
          <router-view></router-view>
        </transition>
    </div>
    

    相关文章

      网友评论

          本文标题:vue中使用animate.css并为路由添加过渡

          本文链接:https://www.haomeiwen.com/subject/jnkxqhtx.html