vue+element-ui之 el-table组件中<template scope="scope">的理解和使用

element-ui官网的table组件中提到:

通过 Scoped slot 可以获取到 row, column, $index 和 store(table 内部的状态管理)的数据。

使用:

<el-table-column prop="金额" label="金额(万)" min-width="120" align="center" >
      <template slot-scope="scope" >
         <p @click="function1(scope.row.data1,'参数')">
      {{scope.row['金额']|toFixedNum(param)|numFormat(param)}}
     </p>
   </template>
</el-table-column>

 如上述代码,可以在<template scope="scope">中通过scope.row.键名,获取所在行的某一列的数据。同时可以添加点击事件,也可以使用过滤器;

 

emm......关于<template scope="scope">的理解,本来想多写点,一直很忙没时间,等后来有空了,想想下方链接的作者写的不错,那就直接贴上这个链接吧:

https://blog.csdn.net/tg928600774/article/details/81945140

posted @ 2018-11-14 17:20  几何柒期  阅读(37618)  评论(0编辑  收藏  举报