如下:
const dataInfo = ref() const timer = ref() const fetchData = async () => { await HnbdSystemUserListStatus().then((e) => { if (e.code == 0) { dataInfo.value = e.data nextTick() timer.value = setTimeout(() => { fetchData() }, 120000) } }) console.log('平台运行状态数据', dataInfo.value) } fetchData() onBeforeUnmount(() => { clearTimeout(timer.value) timer.value = null })
标签:dataInfo,fetchData,timer,value,vue3,界面,每隔,const From: https://www.cnblogs.com/wangpengfei-CN/p/17054788.html