Vue使用v-for 循環生成tabs 標簽頁


實現最終效果:

 

 

 

template代碼:
activeName:默認第一個顯示的tab
<el-tabs v-model="activeName" type="card" @tab-click="handleClick">
  <el-tab-pane :label="item.subCompanyName" :name="item.subCompanyName" :key="item.subCompanyId" v-for="item in value.subCompanyList "></el-tab-pane>  
 </el-tabs> 

 <el-table ref="TaskListDistributionDetailTable" id="TaskListDistributionDetailTable" border :data="item.dataList.filter(item=>{ return item.targetCategoryId == 1 })" class="materialInfoTable clear-input-v"   show-summary :summary-method="getSummaries"  
                         :span-method="arraySpanMethod" v-if="(item.dataList.filter(item=>{ return item.targetCategoryId == 1 }).length>0)" >
                            <el-table-column type="index" align="center" label="序號" width="60">
                                <template slot-scope="scope">
                                    {{scope.$index+1}}
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="指標分類名稱" min-width="120">
                                <template slot-scope="scope">  
                                    <span>{{scope.row.targetCategoryName}}</span>
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="指標名稱" min-width="120">
                                <template slot-scope="scope">  
                                    <span>{{scope.row.targetName}}</span>      
                                </template>
                            </el-table-column>
                            <el-table-column align="left" label="指標量化" min-width="500">
                                <template slot-scope="scope">  
                                    <span>{{scope.row.targetQuantification}}</span>     
                                </template>
                            </el-table-column>
                            <el-table-column align="left" label="設定分值" prop="standardScore" min-width="100">
                                <template slot-scope="scope"> 
                                    <span>{{scope.row.standardScore}}</span>    
                                </template>
                            </el-table-column>
                            <el-table-column align="left" label="評分細則" min-width="300">
                                <template slot-scope="scope"> 
                                    <span>{{scope.row.scoreRules}}</span>      
                                </template>
                            </el-table-column>
                            <el-table-column align="left" label="分公司名稱" min-width="100">
                                <template slot-scope="scope"> 
                                    <span>{{scope.row.subCompanyName}}</span>      
                                </template>
                            </el-table-column>
                            <el-table-column align="center" label="上年度公司排名" min-width="110">
                                <template slot-scope="scope"> 
                                    <span>{{scope.row.prevYearRank}}</span>      
                                </template>
                            </el-table-column>  
                        </el-table>
View Code

data中定義第一個顯示的tab

 

 data: function () {
            return { 
                activeName: '', 
            };
        },

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM