Why can't I render prop, the el component of my vue?

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 >

table

Mar.13,2021

add attributes to the

data definition that do not have the property of response.

try not to use the form of 'that.timeTable.courses [I] ='

try to create a new array and fill in the data

finally let that.timeTable.courses = new array

see if it works


it seems that the course attribute is not declared in timeTable.courses [index] when your code is initialized. You can use this.$set to assign values to the data and try

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3c1c9-2bb34.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3c1c9-2bb34.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?