Преглед изворни кода

账户管理-tab切换调整,id有重复,不能作为key值

ZhangWenQiang пре 4 година
родитељ
комит
6b467c39b3
1 измењених фајлова са 6 додато и 5 уклоњено
  1. 6 5
      src/views/hwaccount/HwAccountManager.vue

+ 6 - 5
src/views/hwaccount/HwAccountManager.vue

@@ -27,8 +27,8 @@
     <template v-show='subcontractorName.length'>
       <a-card :bordered='false' title='账户概览' :headStyle='{textAlign:"center"}' class='account-info'>
         <!-- 查询区域 -->
-        <a-tabs default-active-key='1' @change='chooseSubcontractor' style='width: 100%'>
-          <a-tab-pane :key='item.id' :tab='item.subcontractorName' v-for='(item,key) in Subcontractor'
+        <a-tabs defaultActiveKey='1' @change='chooseSubcontractor' style='width: 100%'>
+          <a-tab-pane v-for='(item,key) in Subcontractor' :key='key+1' :tab='item.subcontractorName'
                       :value='key'></a-tab-pane>
         </a-tabs>
         <div class='table-page-search-wrapper'>
@@ -304,7 +304,7 @@ export default {
       accountId: '',
       subcontractorId: '',
       subcontractorName: '',
-      subcontractorKey: '',
+      subcontractorKey: '0',
       cpType: '',
       companyId: '',
       noPayment: 0,
@@ -332,7 +332,7 @@ export default {
           }
           this.Subcontractor = res.result
           if (this.Subcontractor.length) {
-            this.chooseSubcontractor(0)
+            this.chooseSubcontractor(1)
           }
         }
         if (res.code === 510) {
@@ -409,7 +409,8 @@ export default {
       })
     },
     chooseSubcontractor(index) {
-      if (index || index === 0) {
+      if (index) {
+        index = index - 1;
         this.information = this.Subcontractor[index]
         this.subcontractorId = this.Subcontractor[index].subcontractorId
         this.subcontractorName = this.Subcontractor[index].subcontractorName