自定義el-table-column 后台的數據格式:數組對象,且每條對象中有一個數組對象
一 數據格式:

每條對象中goodsCategoryList的數據是一種類型。
二 代碼
<el-table-column v-for="(item, index) in tableData[0].goodsCategoryList" :key="index" :label="item.attrName"> <!-- 數據的遍歷 scope.row就代表數據的每一個對象--> <template slot-scope="scope"> <span>{{scope.row.goodsCategoryList[index].attrValue}}</span> </template> </el-table-column>
v-for="(item, index) in tableData[0].goodsCategoryList"
遍歷tableData[0].goodsCategoryList的目的:1 獲取item,用於給表頭賦值。
2 獲取index,作為下表,用於scope.row.goodsCategoryList[index].attrValue用
本人親測:



