table
< el-table
:data="timeTable.courses"
border
style="width: 100%; margin-top: 20px"
>
<el-table-column
prop ="time" **prop**
label=""
width="180">
</el-table-column>
<el-table-column
prop ="course[0]"
label="">
</el-table-column>
<el-table-column
prop ="course[1]"
label="">
</el-table-column>
<el-table-column
prop ="course[2]"
label="">
</el-table-column>
<el-table-column
prop ="course[3]"
label="">
</el-table-column>
<el-table-column
prop ="course[4]"
label="">
</el-table-column>
<el-table-column
prop ="course[5]"
label="">
</el-table-column>
<el-table-column
prop ="course[6]"
label="">
</el-table-column>
</el-table>
<script>
export default {
data() {
return {
timeTable:{
studentName:"",
class:"201705",
term:"",
courses:new Array(5), ****
}
};
},
mounted () {
const that = this;
this.$http.get(
that.$interface+"queryClass?term=2016-2017-2"
)
.then(function (response) {
if(response.data!==false){
for(var i = 0;i<5;iPP){
****
that.timeTable.courses[i] = {time:(2*i+1) + "," + (2*i+2),course:["","","","","","",""]};
}
response.data.data.forEach(function(item){ ****
var temp = item.classTime.split("-");
var row = (temp[1]- 1)/2;
var col = temp[0] - 1;
that.timeTable.courses[row].course[col] = item.course;
});
console.log(that.timeTable.courses);
}else{
that.$message({
message: response.data.msg,
type: "warning"
});
}
})
.catch(function (err) {
console.log(err);
that.$message({
message: " error",
type: "warning"
})
});
},
methods: {
}
}
< / script >