Browse Source

收藏之后的数据回显

liuQiang 2 years ago
parent
commit
15a8c40eec
1 changed files with 12 additions and 8 deletions
  1. 12 8
      src/views/myfile/MyFile.vue

+ 12 - 8
src/views/myfile/MyFile.vue

@@ -919,7 +919,7 @@ export default {
         // 重命名
         function restName(row, index) {
             // 判断是点击打开还是右键菜单打开
-            row = row ? row : thisFolder.value
+            row = row ? row : clickRow.value
             copyFolderName.value = row.dirName
             selectedBox.value = row.dirId
             rename.value = true
@@ -992,7 +992,7 @@ export default {
             if(row){
                 thisFolder.value = row;
             }else{
-                row =thisFolder.value
+                row =clickRow.value
             }
             console.log('row', toRaw(row));
             topPath.value = row.dirPath
@@ -1147,8 +1147,10 @@ export default {
         const folderRClick = (row, col, e) => {
             e.preventDefault();
             e.stopPropagation();
+            // thisFolder.value = ''   //先清空
             let thisRow = toRaw(row)
-            thisFolder.value = thisRow;
+            // console.log('thisFolder',thisFolder.value);
+            clickRow.value = thisRow
             copyFolderName.value = row.dirName
             //  唤出右键菜单,思路:获取鼠标位置来定位菜单
             folderVisible.value = true;
@@ -1163,9 +1165,9 @@ export default {
         // 文件夹收藏事件
         const collectFolder = () => {
             isFolder.value = 'Y'
-            clickRow.value = thisFolder.value
+            // clickRow.value = thisFolder.value
             // thisFolder.value = ''
-            copyFileName.value = thisFolder.value.dirName
+            copyFileName.value = clickRow.value.dirName
             collects.value = true
         }
         // 左箭头事件
@@ -1227,11 +1229,12 @@ export default {
         }
         //点击收藏后刷新文件
         const refreshFile = ()=>{
-            if(thisFolder.value){//如果点开了文件夹
-            // console.log(111);
+            // console.log('ref',toRaw(thisFolder.value));
+            if(toRaw(thisFolder.value).isFavorite){//如果点开了文件夹
+            console.log(111);
                folderClick()
             }else{
-            // console.log(222);
+            console.log(222);
                 getAllTop()
             }
         }
@@ -1254,6 +1257,7 @@ export default {
             const res = await delFavorite(query)
             //TODO 之后需要重新获取数据 并message提示
             console.log('res',res);
+            refreshFile()
         }
         onMounted(() => {
             getAllTop()