如下图所示,这是一个ele UI库中的table,一般情况下我们只能通过tableDATA来向里面填充数据来展示,而无法对其中添加点击时间等操作。这里就来记录学习一下。
这是我们的一般使用方法,只能将数据进行展示。我们需要在el-table-column标签里面来进行处理
<el-table :data="tableData" style="width: 100%;height: 450px;"
:row-class-name="tableRowClassName">
:row-class-name="tableRowClassName">
<el-table-column
prop="title"
label=""
width="500">
</el-table-column>
<el-table-column
prop="author"
label=""
width="100">
</el-table-column>
</el-table>
我们在标签里面加上我们自定义的标签,可以通过{{scope.row.title}}的方法来获取数据,并来修改展示的效果。如下面所示。
<el-table :data="tableData" style="width: 100%;height: 450px;"
:row-class-name="tableRowClassName">
:row-class-name="tableRowClassName">
<el-table-column
prop="title"
label=""
width="500">
<template slot-scope="scope">
<a @click="detail(scope.row.id)" style="color:black;cursor:pointer;font-size: 16px;">{{
scope.row.title
}}</a>
</template>
</el-table-column>
<el-table-column
prop="author"
label=""
width="100">
</el-table-column>
</el-table>