在最外层加个点击事件 data:{ clickTime: new Date(), timeout: null }, methods:{ clickApp(){ var nowTime = new Date() if(nowTime - this.clickTime <= 30000){//如果距离上次点击小于30s clearTimeout(this.timeout) this.timeout = setTimeout(function(){ //清楚用户数据的代码 },30000) } this.clickTime = nowTime //设置点击时间为当前时间 } }
在最外层加个点击事件