vue动画(transition)

Vue动画(transition)

动画列表(选择其中一个即可)

/* fade */
.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.28s;
}
​
.fade-enter,
.fade-leave-active {
  opacity: 0;
}
/* fade */
​
/* fade-transform */
.fade-transform-leave-active,
.fade-transform-enter-active {
  transition: all .5s;
}
​
.fade-transform-enter {
  opacity: 0;
  transform: translateX(-30px);
}
​
.fade-transform-leave-to {
  opacity: 0;
  transform: translateX(30px);
}
/* fade-transform */
​
/* breadcrumb */
.breadcrumb-enter-active,
.breadcrumb-leave-active {
  transition: all .5s;
}
​
.breadcrumb-enter,
.breadcrumb-leave-active {
  opacity: 0;
  transform: translateX(20px);
}
​
.breadcrumb-move {
  transition: all .5s;
}
​
.breadcrumb-leave-active {
  position: absolute;
}
/* breadcrumb */
​
/* page-transition */
.page-transition-enter,
.page-transition-leave-to {
  opacity: 0;
  transform: scale(.5, 1);
}
​
.page-transition-enter-active {
  transition: all 0.1s ease;
}
​
.page-transition-leave-active {
  transition: all 0.2s ease;
}
/* page-transition */
​
/* collapseTransition */
// 
// 
/* collapseTransition */
​
/* sidebarLogoFade */
.sidebarLogoFade-enter-active {
  transition: opacity 1.5s;
}
​
.sidebarLogoFade-enter,
.sidebarLogoFade-leave-to {
  opacity: 0;
}
/* sidebarLogoFade */
​
/* 设置左侧盒子显示/隐藏的动画  leftCompTransition */
.leftCompTransition-enter {
  opacity: 1;
  transform: translateX(-100%);
}
​
.leftCompTransition-leave-to {
  opacity: 1;
  transform: translateX(-480px);
  // 解决页面从上往下位移问题
  position: absolute;
}
​
.leftCompTransition-enter-active,
.leftCompTransition-leave-active {
  transition: all 0.5s ease;
}
​
/* 设置左侧盒子显示/隐藏的动画  */
​
/* 设置右侧盒子显示/隐藏的动画  rightCompTransition */
.rightCompTransition-enter {
  opacity: 1;
  transform: translateX(480px);
}
​
.rightCompTransition-leave-to {
  opacity: 1;
  transform: translateX(480px);
  // 解决页面从上往下位移问题
  position: absolute;
}
​
.rightCompTransition-enter-active,
.rightCompTransition-leave-active {
  transition: all 0.5s ease;
}
​
/* 设置右侧盒子显示/隐藏的动画  */

简单使用

注意:transition 需配合 v-if / v-show使用

   
      
   

完整使用(案例)


      
外面的大盒子
   
​    
         
​ ​     isShowBox: true,   changeIsShowBox() {     this.isShowBox = !this.isShowBox;   } ​ ​ ​ ​ ​ .choose-box { width: 500px; background-color: #ffffff; position: absolute; top: 0; left: 0; bottom: 0; z-index: 999 !important; box-shadow: 4px 0px 8px 0px rgba(0, 0, 0, 0.1), inset -1px 0px 0px 0px #eeeeee; border-radius: 4px; } ​ ​ .folding-box { z-index: 999 !important; width: 16px; height: 72px; background: #59AAF5; border-radius: 0 36px 36px 0; position: absolute; top: 0; bottom: 0; margin: auto 0; color: #FFFFFF; text-align: center; line-height: 72px; cursor: pointer; transition: left 0.5s ease; ​  &-show {   left: 502px; } ​  &-hide {   left: 0px; } } ​

你可能感兴趣的:(css,vue项目中常用操作,后台管理系统,vue.js,前端,javascript)