瀏覽代碼

提交修改

XiaBx 3 年之前
父節點
當前提交
b94a8ba310
共有 2 個文件被更改,包括 10 次插入6 次删除
  1. 2 2
      src/views/put/landing/add.vue
  2. 8 4
      src/views/put/landing/stepComp/step-one.vue

+ 2 - 2
src/views/put/landing/add.vue

@@ -7,7 +7,7 @@
           <a-step title="编辑内容" />
         </a-steps>
       </div>
-      <div class="step-content-container">
+      <div class="step-content-container" >
         <component
           :is="stepComponent[stepCurrent]"
           :content="forms"
@@ -64,7 +64,7 @@ const LandingAddPage = defineComponent({
         next();
       }
     });
-
+    
     if (route.query && route.query.id) {
       getLandingInfo(route.query.id as string).then((res) => {
         state.forms = res.data;

+ 8 - 4
src/views/put/landing/stepComp/step-one.vue

@@ -104,10 +104,10 @@
 </template>
 
 <script lang="ts">
-import { defineComponent, reactive, ref, toRefs } from "vue";
+import { defineComponent, reactive, ref, toRefs,watch } from "vue";
 import { InfoCircleOutlined } from "@ant-design/icons-vue";
 import { useForm } from "@ant-design-vue/use";
-import { useRouter } from "vue-router";
+import useApp from "@/hooks/useApp";
 import store from "@/store";
 import { MutationType } from "@/store/modules/app/_type";
 import ImageUpload from "@/components/image-upload/index.vue";
@@ -129,7 +129,7 @@ const StepOne = defineComponent({
   },
   emits: ["next"],
   setup(props, { emit }) {
-    const router = useRouter();
+    const { route, router } = useApp();
 
     const state = reactive({
       officials: ref<IGZHItem[]>([]),
@@ -177,7 +177,11 @@ const StepOne = defineComponent({
         },
       ],
     });
-
+    watch( (props as any)?.content,(newProps, oldProps) => {
+     if (route.query && route.query.id) {
+       state.forms = Object.assign(state.forms, (props as any)?.content ?? {});
+      }
+    });
     const { validate, validateInfos } = useForm(state.forms, formsRules);
 
     const initConfigData = async () => {