修改Element中的el-table样式,可以使用以下几种方法:
1. row-style 行的 style 的回调方法,也可以使用一个固定的 Object 为所有行设置一样的 Style。
2. cell-style 单元格的 style 的回调方法,也可以使用一个固定的 Object 为所有单元格设置一样的 Style。
3. header-row-style 表头行的 style 的回调方法,也可以使用一个固定的 Object 为所有表头行设置一样的 Style。
4. header-cell-style 表头单元格的 style 的回调方法,也可以使用一个固定的 Object 为所有表头单元格设置一样的 Style。
示例代码如下:
复制代码
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81<template> <div> <div style="width:700px;margin: 0 auto;"> <el-table :data="tableData" height="300" border stripe="true" :row-style="tableRowStyle" :header-cell-style="tableHeaderColor" style="width: 100%"> <el-table-column prop="tag" label="tag" width="150"> </el-table-column> <el-table-column prop="confidence" label="confidence" width="180"> </el-table-column> <el-table-column prop="category_tag_level" label="category_tag_level"> </el-table-column> </el-table> </div> </div> </template> <script> export default{ data () { return { tableData: [{ tag: '体育', confidence: '0.8213628173213', category_tag_level: '123' }, { tag: '体育', confidence: '0.8213628173213', category_tag_level: '123' }, { tag: '体育', confidence: '0.8213628173213', category_tag_level: '123' }, { tag: '体育', confidence: '0.8213628173213', category_tag_level: '123' }, { tag: '体育', confidence: '0.8213628173213', category_tag_level: '123' }, { tag: '体育', confidence: '0.8213628173213', category_tag_level: '123' }, { tag: '体育', confidence: '0.8213628173213', category_tag_level: '123' }] } }, methods:{ //设置表格行的样式 tableRowStyle({row,rowIndex}){ return 'background-color:pink;font-size:15px;' }, //设置表头行的样式 tableHeaderColor({row,column,rowIndex,columnIndex}){ return 'background-color:lightblue;color:#fff;font-wight:500;font-size:20px;text-align:center' } } } </script> <style> </style>
效果如下所示:
以上就是vue修改Element的el-table样式的4种方法的详细内容,更多关于vue修改Element的el-table样式的资料请关注靠谱客其它相关文章!
最后
以上就是大方薯片最近收集整理的关于vue修改Element的el-table样式的4种方法的全部内容,更多相关vue修改Element内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复