<el-button type="info" @mousedown.native="gmousedown" @mouseup="gmouseup">测试</el-button>
<script>
export default{
setup(){
var myTimeDisplay
//长按事件(起始)
function gmousedown() {
myTimeDisplay = setInterval(() => {
console.log(123)
}, 50);
}
function gmouseup() {
clearInterval(myTimeDisplay);
}
return{
gmousedown,
gmouseup,
}
}
}
</script>
The actual test is useful, if you have any questions, welcome to comment, exchange and learn from each other, hope to like and collect more