Element表格单元格的几种点击事件
1.cell-click 单元格触发事件
<template>
<el-table :data="tableData" style=" 100%" @cell-click="goclick">
<el-table-column prop="date" label="日期" width="180">
</el-table-column>
<el-table-column prop="name" label="姓名" width="180">
</el-table-column>
<el-table-column prop="address" label="地址">
</el-table-column>
</el-table>
</template>
methods: {
goclick(row,column,event,cell) {
console.log(row,column,event,cell)
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
2.普通click点击事件
<template>
<el-table :data="tableData" style=" 100%">
<el-table-column prop="date" label="日期" width="180">
</el-table-column>
<el-table-column prop="name" label="姓名" width="180">
</el-table-column>
<el-table-column prop="address" label="地址">
<template slot-scope="scope">
<div @click='goclick(scope.row.address)'>{{scope.row.address}}</div>
</template>
</el-table-column>
</el-table>
</template>
methods: {
goclick(address) {
console.log(address)
}
}
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19