vue2.0和animate.css的结合使用
animate.css是一款前端动画库,相似的有velocity-animate。

上述是一个完整的结构。其中重要的几个点用箭头表示出来。首先在transition组件内部,需要定义两个基本的class类,表示过渡进来和过渡出去的时候所要配合使用的animate.css的类值。zoomInLeft/zoomOutRight是其中的一对儿。具体的其它效果可以查看animatecss的官网。其次在transition组件内部的话,需要过渡的子元素需要加上animated类。最后可能也是比较容器忽略的点,这个v-show看似好像是多余的,但是不加上的话,对于过渡效果是没用的。因为过渡是从一个从无到有的一个效果。最开始进来的时候如果元素本身是show 的,那么过渡就失效了。所以在元素上面需要加上这个v-show属性。在过渡进来的时候,v-show设置为true,相反为false。
下面看一段实例代码vue过渡和animate.css结合使用
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>动画</title>
<script src="https://cdn.bootcss.com/vue/2.5.16/vue.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.bootcss.com/animate.css/3.5.2/animate.min.css" rel="external nofollow" />
</head> <body>
<div id="box">
<!-- 控制数据的值切换显示隐藏 -->
<button @click="show=!show">transition</button>
<transition name="" mode="" enter-active-class="zoomInLeft" leave-active-class="zoomOutRight">
<p v-show="show" class="animated">第一种方法</p>
</transition>
<transition name="" mode="" enter-active-class="animated zoomInLeft" leave-active-class="animated zoomOutRight">
<p v-show="show">第二种方法</p>
</transition>
<!-- 多元素运动 -->
<transition-group tag="" name="" enter-active-class="zoomInLeft" leave-active-class="zoomOutRight">
<p v-show="show" class="animated" :key="1">第一个元素</p>
<p v-show="show" class="animated" :key="2">第二个元素</p>
</transition-group>
</div> <script>
window.onload = function(){
var app = new Vue({
el:'#box',
data:{
show:false
}
})
}
</script>
</body>
</html>
vue2.0和animate.css的结合使用的更多相关文章
- vue2.0-transition配合animate.css
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- vue2.0引入现有css文件
1.在vue文件中的<style>内填写需要引用的文件 如: @import "./css/indexTest.css";
- vue 结合 animate.css
这里说的是vue2.0和animate.css的结合使用.其实用过就知道用法是比较简单的.但是就是刚开始使用的时候,难免有的会遇到各种问题.简单的说说我所用过并且遇过的坑. 首先是transition ...
- vue2.0动画
相对于vue1.0来说,vue2.0的动画变化还是挺大的, 在1.0中,直接在元素中加 transition ,后面跟上名字. 而在vue2.0中,需要把设置动画的元素.路由放在<transit ...
- vue2+animate.css
下载animate.css并引入项目, import './css/animate.css'使用: <template> <div class="box"> ...
- vue2借助animate.css实现路由动画效果
第一步: npm install animate.css --save 第二步:打开main.js import animate from 'animate.css' Vue.use(animate) ...
- vue2.0有哪些变化
vue2.0之后有哪些变化: 1.每个组件模板template,不再支持片段代码 之前: <template> <h3>vue-router+vue-loader</h3 ...
- vue2.0自学笔记
前言: 一.优点: 轻量级.高效率.上手快.简单易学.文档全面而简洁 二.功能: 1.模板渲染 2.模块化 3.扩展功能:路由.Ajax 三.课程包含: 1.Vue实例 2.Vue组件 3.Vue指令 ...
- Vue2.0
Vue 1.0到2.0的变化: 1.在每个组件的模板中,不再支持片段代码 组件中的模板: 之前: <template> <h3我是组件<strong>我是加粗模板< ...
随机推荐
- embeddable persistent key-value store for fast storage
A persistent key-value store for fast storage environmentsRocksDB is an embeddable persistent key-va ...
- Java同步数据结构之LinkedTransferQueue
前言 LinkedTransferQueue是Java并发包中最强大的基于链表的无界FIFO阻塞传输队列.从JDK7开始出现,Doug Lea说LinkedTransferQueue是Concurre ...
- mysql密码设置为空怎么办?
由于很多童鞋安装使用MySQL时,安装时没有设置密码,或者像我一样图省事设置密码为空,想为其设置新密码: 1.点击 开始------>运行----在弹出的对话框中输入cmd 如下图: 2.使用 ...
- Swift 条件语句
条件语句通过设定的一个或多个条件来执行程序,在条件为真时执行指定的语句,在条件为 false 时执行另外指定的语句. 可以通过下图来简单了解条件语句的执行过程: Swift 提供了以下几种类型的条件语 ...
- DriverManager
1: 注册驱动 Class.forName("com.mysql.jdbc.Driver") ; static { try { java.sql.DriverManager.reg ...
- 17. dashboard
17. dashboard dashboard的安装步骤: wget https://raw.githubusercontent.com/kubernetes/dashboard/v2.0.0-bet ...
- 怎么通过原生JS改变元素的class属性
解决方法:document.getElementById('test').className = 'emphasis' Eg: <!doctype html> <html lang= ...
- Flutter的闪屏动画案例AnimationController
打开一个APP,经常会看到精美的启动页,这种启动页也称为闪屏动画.它是从无到有有一个透明度的渐变动画的.图像展示完事后,才跳转到用户可操作的页面. AnimationController Animat ...
- 【SVN】总结:svn“Previous operation has not finished; run 'cleanup' if it was interrupted“
svn执行clean up命令时报错“Previous operation has not finished; run 'cleanup' if it was interrupted”.无论你到那个父 ...
- pytorch安装问题
目录 1.版本 2.pytorch调试中出现的Module 'torch' has no 'zero' member如何解决 3.No module named 'numpy.core._multia ...