Vue's slot-scope displays data from the backend

Code first

<el-table>
  <el-table-column label="测试" >
     <template slot-scope="scope" prop="testType">
      //prop可以接收接口的参数,例如这个testType是后端传给你的用来选择状态的参数,就可以这样用
        <span v-if="scope.row.testType==0" >会议进行中</span>
        <span v-if="scope.row.testType==1" >会议准备中</span>
        <span v-if="scope.row.testType==2" >会议结束</span>
     </template>
  </el-table-column>
</el-table>

Today I want to display the back-end data, but I found out that I don’t know how to use slot-scope. Later I checked the information and found that it was used like
this. This is my code

<el-table-column prop="data" label="数据类型" width="180" >
         <template slot-scope="scope">
             <span v-if="scope.row.point==1" >实时数据</span>
             <span v-if="scope.row.point==2" >1小时数据</span>
             <span v-if="scope.row.point==3" >2小时数据</span>
             <span v-if="scope.row.point==4" >4小时数据</span>
             <span v-if="scope.row.point==5" >6小时数据</span>
             <span v-if="scope.row.point==6" >12小时数据</span>
             <span v-if="scope.row.point==7" >24小时数据</span>
            </template>
       </el-table-column>

The result is
Insert picture description here

Guess you like

Origin blog.csdn.net/he1234555/article/details/115250772