Переглянути джерело

修复bug 添加和编辑一个页面导致数据读取问题

zxiansheng 3 роки тому
батько
коміт
515c9c6785

+ 8 - 5
frontendEle/src/views/config/receive-address-edit.vue

@@ -60,14 +60,14 @@
     mounted() {
       if (this.$route.name === 'config_receive-address-add'){
         this.loading = false
+        this.initArea()
       } else {
         this.getData()
       }
-      console.log(this.regionData)
     },
     data() {
       return {
-        regionData: store.state.regionInfo.regionData,
+        regionData: [],
         form: {
           consignee: '',
           mobile: '',
@@ -116,9 +116,12 @@
           this.submitButtonStat = false
         })
       },
-      getData() {
-        network.getData(`config/receive-address-one/${this.$route.params.id}`).then(response=>{
-          console.log(response)
+      initArea() {
+        this.regionData = store.state.regionInfo.regionData
+      },
+       async getData() {
+         await network.getData(`config/receive-address-one/${this.$route.params.id}`).then(response=>{
+          this.regionData = store.state.regionInfo.regionData
           this.form.consignee = response.CONSIGNEE
           this.form.mobile = response.MOBILE
           this.form.areaSelected[0] = response.PROVINCE