vue中给元素同时绑定单击事件&&双击事件

            // 网元图标的单击&&双击处理事件
            window.count = 0;
            window.timer = null;
            clickAndDbclick(id,typeId){
                window.count++;
                if (window.timer == null) {
                    let that = this;
                    window.timer = setTimeout(function () {
                    if (window.count > 1) {
                        // 双击事件
                        that.moreInfo(id,typeId);
                        window.timer = null;
                    } else {
                        // 单击事件
                        that.showNeHealthOverviewData(id,typeId);
                        window.timer = null;
                    }
                    window.count = 0;
                    }, 250)
                }
            },

 

你可能感兴趣的:(vue)