我现在代码是这样的,但是要求是动态遍历 做成如下效果
我现在遍历表头或者数据有一样是不对的
<el-table
ref="multipleTable"
:data="tableData"
stripe
border
style="width: 100%"
:header-cell-style="thStyle"
:cell-style="tdStyle"
>
<el-table-column type="selection" width="55"> </el-table-column>
<el-table-column type="index" label="序号">
<div slot-scope="scope">
{{ scope.row.id + 1 }}
</div>
</el-table-column>
<el-table-column prop="name" label="项目名称">
<div
slot-scope="scope"
@contextmenu.prevent="openmenu"
@click="leftClick"
>
{{ scope.row.name }}
</div>
</el-table-column>
<el-table-column prop="address" label="学生信息">
<div
slot-scope="scope"
@contextmenu.prevent="openmenu"
@click="leftClick"
>
{{ scope.row.address }}
</div>
</el-table-column>
<el-table-column prop="date" label="打印条码">
<div
slot-scope="scope"
@contextmenu.prevent="openmenu"
@click="leftClick"
>
{{ scope.row.date }}
</div>
</el-table-column>
<el-table-column prop="teacher" label="教师信息">
<div
slot-scope="scope"
@contextmenu.prevent="openmenu"
@click="leftClick"
>
{{ scope.row.teacher }}
</div>
</el-table-column>
<el-table-column prop="rw" label="任务分配">
<div
slot-scope="scope"
@contextmenu.prevent="openmenu"
@click="leftClick"
>
{{ scope.row.rw }}
</div>
</el-table-column>
<el-table-column prop="sj" label="试卷设置">
<div
slot-scope="scope"
@contextmenu.prevent="openmenu"
@click="leftClick"
>
{{ scope.row.sj }}
</div>
</el-table-column>
<el-table-column prop="sx" label="双向细目表">
<div
slot-scope="scope"
@contextmenu.prevent="openmenu"
@click="leftClick"
>
{{ scope.row.sx }}
</div>
</el-table-column>
<el-table-column prop="sjk" label="数据库">
<div
slot-scope="scope"
@contextmenu.prevent="openmenu"
@click="leftClick"
>
{{ scope.row.sjk }}
</div>
</el-table-column>
</el-table>
数据
tableData: [
{
title: "标题1",
id: 0,
date: "2016-05-03",
name: "王小",
address: "上海市普陀区金沙江路 1518 弄",
},
{
title: "标题2",
id: 1,
date: "2016-05-02",
name: "王小虎",
address: "上海市普陀区金沙江路 1518 弄",
},
{
title: "标题3",
id: 2,
date: "2016-05-04",
name: "王虎",
address: "上海市普陀区金沙江路 1518 弄",
},
{
title: "标题4",
id: 3,
date: "2016-05-01",
name: "王小虎1",
address: "上海市普陀区金沙江路 1518 弄",
},
{
title: "标题5",
id: 4,
date: "2016-05-08",
name: "王小1",
address: "上海市普陀区金沙江路 1518 弄",
},
{
title: "标题6",
id: 5,
date: "2016-05-06",
name: "王虎1",
address: "上海市普陀区金沙江路 1518 弄",
},
{
title: "标题7",
id: 6,
date: "2016-05-07",
name: "王虎2",
address: "上海市普陀区金沙江路 1518 弄",
},
{
title: "标题8",
id: 7,
date: "2016-05-07",
name: "王虎2",
address: "上海市普陀区金沙江路 1518 弄",
},
{
title: "标题9",
id: 8,
date: "2016-05-07",
name: "王虎2",
address: "上海市普陀区金沙江路 1518 弄",
},
{
title: "标题10",
id: 9,
date: "2016-05-07",
name: "王虎2",
address: "上海市普陀区金沙江路 1518 弄",
},
{
title: "标题11",
id: 10,
date: "2016-05-07",
name: "王虎2",
address: "上海市普陀区金沙江路 1518 弄",
},
],
求指导一下 急
表头和数据对应关系不对。项目名称、学生信息表头对应的值写错了。
修改如下: