LiuJ il y a 3 semaines
Parent
commit
94078b11b9
1 fichiers modifiés avec 24 ajouts et 0 suppressions
  1. 24 0
      src/views/news/creatNews.vue

+ 24 - 0
src/views/news/creatNews.vue

@@ -326,6 +326,30 @@ export default {
       //表单项 end ------------------------------------------------------------>
     };
   },
+  watch: {
+    // '$route'(to, from) {
+    //   console.log(to, from);
+    //   // 监听路由参数中的 id 变化,若变化则更新页面状态并获取数据
+    //   if (to.query.id) {
+    //     this.getMainData();  
+    //   }
+    // }
+
+
+    // 监听路由参数中的 id 变化,若变化则更新页面状态并获取数据
+    // '$route.query.id': function (newVal, oldVal) {
+    //   console.log('当前 id:', newVal, '旧的 id:', oldVal);
+    //   if (newVal) {
+    //     this.editStatus = true;
+    //     this.tableDivTitle = "编辑资讯";
+    //     // 调用方法名保持大小写一致
+    //     this.getMainData(); 
+    //   } else {
+    //     this.editStatus = false;
+    //     this.tableDivTitle = "添加资讯";
+    //   }
+    // }
+  },
   methods: {
     //1.提交表单 start ------------------------------------------------------------>
     //1.1 直接上传图片