【增加】Image 列表组件取消挂在 销毁定时刷
							parent
							
								
									c96f3cea61
								
							
						
					
					
						commit
						520244eea9
					
				| 
						 | 
				
			
			@ -87,9 +87,10 @@ const downloadImage = async (imageUrl) => {
 | 
			
		|||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//
 | 
			
		||||
/** 暴露组件方法 */
 | 
			
		||||
defineExpose({getImageList})
 | 
			
		||||
//
 | 
			
		||||
 | 
			
		||||
/** 组件挂在的时候 */
 | 
			
		||||
onMounted(async () => {
 | 
			
		||||
  // 获取 image 列表
 | 
			
		||||
  await getImageList()
 | 
			
		||||
| 
						 | 
				
			
			@ -98,9 +99,12 @@ onMounted(async () => {
 | 
			
		|||
    await getImageList()
 | 
			
		||||
  }, 1000 * 20)
 | 
			
		||||
})
 | 
			
		||||
//
 | 
			
		||||
onUnmounted(async () => {
 | 
			
		||||
 | 
			
		||||
/** 组件取消挂在的时候 */
 | 
			
		||||
onUnmounted(async () => {
 | 
			
		||||
  if (imageListInterval.value) {
 | 
			
		||||
    clearInterval(imageListInterval.value)
 | 
			
		||||
  }
 | 
			
		||||
})
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue