Vue traverses json data

an intern recently started to work on a project, and encountered a problem, that is, traversing json data, usually with the combination name of json data, so it is better to display the data directly in the table, but I got no json array name, it is a bit confused.

clipboard.png

data012

clipboard.png
{{list.id}}

clipboard.png
postmanjson

clipboard.png
how should I correctly traverse this data to table? And show it, I know it"s simple, but a novice, don"t spray!

Apr.28,2022

you should use scope.id instead of list.id


<el-table-column prop="id">
    <template slot-scope="scope">
        <span>{{ scope.row.id }}<span>
    </template>
</el-table-column>

scope.row is the information for the current row
scope.$index is the index
scope.column is the information for the current column

other synonyms


 <table>
      <tr v-for="(item,index) in data" :key="index">
        <td>{{item.name}}</td>
        <td>{{item.chargeMode}}</td>
        ...
      </tr>
    </table>

write about
suppose the array you want to render to Table is called list, then you request the data and assign it to list

we.request('your/api', param)
    .then((res) => {
    this.list = res.data  // res.data
})

then in the page

    <el-table
      :data="list"
      style="width: 100%">
      <el-table-column
        prop="id"
        label=""
        width="180">
      </el-table-column>
      <el-table-column
        prop="name"
        label=""
        width="180">
      </el-table-column>
      <el-table-column
        prop="chargeMode"
        label="xxx">
      </el-table-column>
    </el-table>
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-1b3f0ea-409ed.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-1b3f0ea-409ed.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?