进入界面执行
onMounted(() => {
times();
});
const timer = ref();
//2秒一次
function times(){
timer.value = setInterval( () => {
select_time();
}, 2000)
}
//离开界面
onUnmounted(() => {
// 每次离开当前界面时,清除定时器
clearInterval(timer.value)
timer.value = null
})
//查询
function select_time(){
console.log(123456)
}
vue3进入界面,离开界面,定时
大得3692023-08-31 15:45
相关推荐
镜宇秋霖丶9 小时前
2026.5.6@霖宇博客制作中遇见的问题计算机专业码农一枚9 小时前
微信小程序 uniapp+vue高校社团管理小李子呢021110 小时前
前端八股Vue---Vue-router路由管理器Momo__15 小时前
Vue 3.6 Vapor Mode:跳过虚拟 DOM,性能极致优化walking95716 小时前
重新学习前端之JavaScriptwalking95716 小时前
重新学习前端之HTMLwalking95716 小时前
重新学习前端之Vue泉城老铁16 小时前
springboot实现word转换pdfwalking95716 小时前
重新学习前端之Linuxwalking95716 小时前
重新学习前端之CSS