zoukankan      html  css  js  c++  java
  • vue开发移动端项目 过渡动画问题

     App.vue: 
      <div id="app">
        <div class="content">
          <transition :name="transitionName" :duration="{ enter: 500, leave: 0 }">
            <router-view class="transitionBody"></router-view>
          </transition>
        </div>
        <Nav v-if="!hideNav"></Nav>
      </div>
     
      css: 
        .transitionBody{
          position: absolute;
          top: 0;
           100%;
          transition: all 0.3s ease; /*定义动画的时间和过渡效果*/
        }
     
        .transitionLeft-enter,
        .transitionRight-leave-active {
          -webkit-transform: translate(100%, 0);
          transform: translate(100%, 0);
          /*当左滑进入右滑进入过渡动画*/
        }
        .transitionLeft-leave-active,
        .transitionRight-enter {
          -webkit-transform: translate(-100%, 0);
          transform: translate(-100%, 0);
        }
     
      js判断部分
     
        watch: {
          $route (to, from){
            const arr = ['myFans','forgetPwd','dtIncome', 'jtIncome'];
            const compare = arr.indexOf(to.name)>arr.indexOf(from.name);
            this.transitionName = compare ? 'transitionLeft' : 'transitionRight';
          }
        },
  • 相关阅读:
    开源的Ajax.Net类库
    开放的即时通信协议Jabber
    代码生成工具之MyGeneration
    清华梦的粉碎—写给清华大学的退学申请(牛人 王垠 )
    [.NET网格计算框架] Alchemi
    .net安全类库
    使用Facility:EnterpriseLibrary整合进Castle
    castle project 发布新版本
    10招步骤保护IIS服务器安全
    应用IBatisNet+Castle进行项目的开发
  • 原文地址:https://www.cnblogs.com/Mr-Rshare/p/10207179.html
Copyright © 2011-2022 走看看