apiCloud 双击事件

apiCloud 双击事件只能使用纯js去写

        var app = new Vue({
            el: "#app",
            data: function() {
                return {
                    token: '',
                    us_id: '',
                    lastClickTime: 0,
                    lastClickId: 0
                }
            },
            methods: {
                follow:function(nc_id,r_index){
                    var this_obj= this;
                    var currentTime=new Date().getTime()
                    if(this.lastClickId != nc_id){
                        this.lastClickId = nc_id;
                    }else{
                        if(( currentTime - this.lastClickTime)< 300){
                            var a_data = {
                                token: this_obj.token,
                                nc_id: nc_id,
                                us_id: this_obj.us_id
                            };
                            var a_url = "/Info/add_follow_class";
                            common_ajax(a_url, a_data, function(res) {
                                this_obj.sort.push(res.info)
                                this_obj.more_sort.splice(r_index,1)
                            }, function(res) {
                                api.toast({
                                    msg: res.info
                                });
                            });
                        }
                    }
                    this.lastClickTime = currentTime
                }
            }
        });
        app.ready();

 

posted @ 2018-01-17 18:03  小短腿奔跑吧  阅读(582)  评论(0编辑  收藏  举报