vue2.0 动画+ stylus

一个vue2.0动画+stylus的博客文章地址:https://www.cnblogs.com/jr1993/p/vue.html

以前这样子写的

    <div transition="move" class="cart-decrease" v-show="food.count>0" @click="decreaseCart">
        <span class="inner icon-remove_circle_outline"></span>
    </div>

现在要这样子写:

但是,style写法还是一样的,是父子级关系: .move.cart-decrease父子级关系

<div class="cartcontrol">
        <transition name="move">
             <div  class="cart-decrease" v-show="food.count>0" @click="decreaseCart">
                <span class="inner icon-remove_circle_outline"></span>
            </div>
        </transition>
    </div>

stylus写法

减号字体图标 动画 :

  1. 向左平移 (opacity:0 >1)
  2. 里面的一横旋转180度 (transform rotate0 > 180deg)
  3. 回来时相反
<style lang="stylus" rel="stylesheet/stylus">
    .cartcontrol
        font-size 0px
        .cart-decrease  // .move 与 .cart-decrease 是 同级关系 
            display inline-block
            padding 6px
            transition all 0.4s linear 
            &.move-enter-active , &.move-leave
                opacity 1
                transform translate3d(0,0,0)
                .inner
                    transform rotate(0deg)

            .inner
                display inline-block
                line-height 24px
                font-size 24px
                color rgb(0,160,220)
                transition all 0.4s linear

            &.move-enter, &.move-leave-active
                opacity 0
                transform translate3d(24px,0,0)
                .inner
                    transform rotate(180deg)
</style>

另一个动画样式写法:

  <transition name="fade" >
        <div class="list-mask" @click="hideList"  v-show="listShow"></div>
   </transition>
.list-mask
    position fixed
    top 0
    left 0
    width 100%
    height 100%
    z-index 40

    // 动画最终的状态
    background-color rgba(7,17,27,0.6) //这个一定要写上,不能省略,
    -webkit-backdrop-filter blur(10px)
    backdrop-filter blur(10px)
    // 动画开始->最终的状态
    &.fade-enter-active, &.fade-leave   
        transition: all 0.5s  linear
        background-color rgba(7,17,27,0.6)
    // 动画最终的状态->动画结束
    &.fade-enter, &.fade-leave  
        background-color rgba(7,17,27,0)
        transition: all 0.6s  linear
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值