解决办法:
使用 slot ,
自定义 formatter
贴代码
table -colum 代码如下:
formatter 代码如下:
使用 slot ,
自定义 formatter
贴代码
table -colum 代码如下:
<
el-table-column
:prop="
item.label"
v-for="
item in
tableDayItems"
:label="
item.value"
min-width="
120"
align="
center">
<
template
scope="
scope">
<
span
v-html="
dayHourFormatter(
scope.
row.
workHours,
item.value)"></
span>
</
template>
</
el-table-column>
formatter 代码如下:
dayHourFormatter(
workHours,
cellValue) {
let
hour = '';
for(
let
i=
0;
i<
workHours.length;
i++){
if(
workHours[
i].
day==
cellValue){
hour =
workHours[
i].
workHourValue;
}
}
return
hour;
},