vue自制类似购物车效果实例 点击确定出新一个弧形动画

运用场景,点击导出,一个下载标识从导出出发,来到下载中心停止,任务生成。

一、html代码段

<style>
    .add_img {
            width: 50px;
            height: 50px;
            border-radius: 50%;
            position: absolute;
            right: 200px;
            top: -50px;
            z-index: 99999;
            transition: all 1s;
        }
</style>



<div id="downloadCenter">
    <transition v-on:before-enter="beforeEnter" v-on:enter="enter" v-on:after-enter="afterEnter">
        <img class="add_img" v-if="addShow" src="/images/downquit.png" alt="">
    </transition>
</div>

 

二、js代码段

var downloadCenter = new Vue({
        el:'#downloadCenter',
        data:function(){
            var _this=this;
            return{
                addShow:false,
                btnTop:0,
                btnLeft:0
            }
        },
        mounted:function(){
            var _this = this;
        },
        methods: {
            // 进入前状态
            beforeEnter: function(el) {
                var _this = this
                el.style.right = (document.body.scrollWidth - _this.btnLeft) + 'px'
                el.style.top = _this.btnTop + 'px'
                el.style.transform = 'scale(1)'
            },
            // 进入中
            enter: function(el, done) {
                el.offsetWidth
                el.style.right = '200px'
                el.style.top = '0px'
                el.style.transform = 'scale(.5)'
                done()
            },
            // 进入后
            afterEnter: function() {
                var _this = this
                if (_this.addShow) {
                    _this.addShow = false
                }
            },
            download: function (id) {
                var _this = this;
                _this.btnTop = $('#' + id).offset()['top'];
                _this.btnLeft = $('#' + id).offset()['left']+($('#'+id).outerWidth(true));
                _this.addShow = true;
            }
        }
    })

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值