# table单元格点击事件

onInit() {
    this.columns.forEach(column => {
        //修改颜色
        if (column.field == '字段') {
            //格式化返回自定义单元格内容
            // column.formatter = (row) => {
            //     return '<span style="color: #2d8cf0;">' + row.字段 + '</span>'
            // }
            //单元格绑定事件
            column.click = (row, column, event) => {
                this.$message.info(row.字段);
            };
        }   
    })
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15