Browse Source

el-option 的值对应后端返回的 SelectOption 对象

reghao 1 year ago
parent
commit
98eaacac61
2 changed files with 8 additions and 6 deletions
  1. 2 2
      src/views/map/PhotoMap.vue
  2. 6 4
      src/views/post/PostAlbum.vue

+ 2 - 2
src/views/map/PhotoMap.vue

@@ -8,7 +8,7 @@
               <el-option
                 v-for="(item, index) in selectOptions"
                 :key="index"
-                :label="item.name"
+                :label="item.label"
                 :value="item.value"
               />
             </el-select>
@@ -145,7 +145,7 @@ export default {
       },
       selectedOption: 1,
       selectOptions: [
-        { name: '全部', value: 1 }
+        { label: '全部', value: 1 }
       ],
       value: []
     }

+ 6 - 4
src/views/post/PostAlbum.vue

@@ -19,8 +19,8 @@
               @change="onSelectChange"
             >
               <el-option
-                v-for="item in allAlbums"
-                :key="item.label"
+                v-for="(item, index) in allAlbums"
+                :key="index"
                 :label="item.label"
                 :value="item.value"
               />
@@ -153,7 +153,9 @@ export default {
   },
   data() {
     return {
-      allAlbums: [],
+      allAlbums: [
+        { label: '全部', value: 1 }
+      ],
       queryInfo: {
         albumId: null,
         pn: 1
@@ -214,7 +216,7 @@ export default {
           this.dataList = respData.pageList.list
           this.totalSize = respData.pageList.totalSize
           this.albumInfo = respData.albumInfo
-          this.queryInfo.albumId = this.albumInfo.albumId + ''
+          this.queryInfo.albumId = this.albumInfo.albumId
         }
       }).catch(error => {
         this.$message({