Quellcode durchsuchen

feat(公告): 添加页面显示时的分类列表刷新功能

yz vor 3 Wochen
Ursprung
Commit
cc9603d6c6

+ 11 - 1
src/views/announcement/index.vue

@@ -113,7 +113,17 @@ export default {
     components: {
         AnnouncementForm
     },
-    mixins: [AnnouncementIndexMixin]
+    mixins: [AnnouncementIndexMixin],
+    mounted() {
+        if (typeof this.onShow === 'function') {
+            this.onShow();
+        }
+    },
+    activated() {
+        if (typeof this.onShow === 'function') {
+            this.onShow();
+        }
+    }
 };
 </script>
 

+ 9 - 1
src/views/announcement/mixins/announcementIndex.js

@@ -409,6 +409,14 @@ export default {
         getStatusLabel,
         getStatusText: getStatusLabel,
 
+        // 页面显示时触发:刷新分类列表(最小改动)
+        onShow() {
+            // 打印触发标识,便于排查
+            console.log('[公告] onShow 勾子触发');
+            // 重新加载分类下拉数据
+            this.loadCategoryOptions();
+        },
+
         /**
          * 加载分类选项
          * @async
@@ -613,7 +621,7 @@ export default {
                 done();
                 return;
             }
-            
+
             // 对于查看操作,保持原有逻辑
             if (type === "view") {
                 try {