weixin_52219567 1 hete
szülő
commit
e4ad1604e9
1 módosított fájl, 15 hozzáadás és 4 törlés
  1. 15 4
      src/views/home/pc-index.vue

+ 15 - 4
src/views/home/pc-index.vue

@@ -9,11 +9,22 @@ import { getPcDiyIndexPageById } from '@/api/home/diy';
 import diyIndex from '@/views/home/pccomponents/index.vue';
 const route = useRoute();
 const dataInfo = ref<any>(null);
-getPcDiyIndexPageById({ indexId: route.query.id }).then((res) => {
-  if (res.code == 200) {
-    dataInfo.value = res.data;
-  }
+
+onMounted(() => {
+  initData();
+});
+
+watch(route, () => {
+  initData();
 });
+
+const initData = () => {
+  getPcDiyIndexPageById({ indexId: route.query.id }).then((res) => {
+    if (res.code == 200) {
+      dataInfo.value = res.data;
+    }
+  });
+};
 </script>
 
 <style lang="scss" scoped></style>