浏览代码

fix: 添加关闭弹窗的回调,去掉定时器

WANGKANG 8 月之前
父节点
当前提交
27a02436bf
共有 1 个文件被更改,包括 15 次插入2 次删除
  1. 15 2
      src/views/demo/DataSeq/index.vue

+ 15 - 2
src/views/demo/DataSeq/index.vue

@@ -31,7 +31,12 @@
     </ProTable>
     <FormDialog ref="formDialogRef" />
     <!-- <ImportExcel ref="dialogRef" /> -->
-    <el-dialog v-model="dialogVisible" :title="'数据集预览 - 共' + currentImageUrls.length + '张 当前第' + (imageIdx + 1) + '张'" width="80%">
+    <el-dialog
+      v-model="dialogVisible"
+      :title="'数据集预览 - 共' + currentImageUrls.length + '张 当前第' + (imageIdx + 1) + '张'"
+      width="80%"
+      :before-close="handleClose"
+    >
       <el-form :inline="true">
         <el-form-item label="帧率">
           <el-select v-model="imageFps" placeholder="选择帧率" style="width: 200px" @change="changeFps">
@@ -86,6 +91,14 @@ const imageIdx = ref(0)
 const currentImageUrls = ref<string[]>([])
 const newImageIdx = ref()
 
+const handleClose = (done: () => void) => {
+  console.log('handleClose')
+  if (intervalChangeFps.value) {
+    clearInterval(intervalChangeFps.value)
+  }
+  done()
+}
+
 const confirmNewImageIdx = () => {
   const val = parseInt(newImageIdx.value)
   if (val > 0 && val <= currentImageUrls.value.length) {
@@ -96,7 +109,7 @@ const confirmNewImageIdx = () => {
 }
 
 const showImages = async (row: any) => {
-  console.log(row)
+  // console.log(row)
   dialogVisible.value = true
 
   const data: any = await getAllImagesApi(row.inputOssId)