美文网首页Vue2.0
vue2.0—使用animate.css

vue2.0—使用animate.css

作者: 杀个程序猿祭天 | 来源:发表于2018-09-26 15:12 被阅读40次

vue2.0—使用animate.css

构建项目和创建组件就不细说了,不懂的可以去官方文档API学习

VUE官方文档:https://cn.vuejs.org/v2/guide/

1.下载animate.css

cnpm install vue2-animate -S

2.在main.js 中引入animate.css

import Vue from 'vue'
import App from './App'
import router from './router'
import 'vue2-animate/dist/vue2-animate.min.css';
Vue.config.productionTip = false;
new Vue({
  el: '#app',
  router,
  components: { App },
  template: '<App/>'
})

3.在组件中使用

<el-button type="primary" @click="animate">点击发生动画</el-button>
<transition enter-active-class="animated bounceInDown" leave-active-class="animated bounceInLeft">
        <p v-if="flag2">Animate</p>
</transition>

<script>
export default {
   data(){
    return{
      flag2:true,
    }
   },
   methods:{
    animate(){
        this.flag2 = !this.flag2;
    }
   },
  
}
</script>

相关文章

网友评论

    本文标题:vue2.0—使用animate.css

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