The table component in iview, how to make the number with a median value of 0 in the grid displayed in green

clipboard.png

the table component in iview, how to make the numbers with a median value of 0 in the grid display in green and the rest in red

Feb.28,2021

just use the render function and then use a ternary expression for backgroundColor

render: (h, params) => {
    return h('span', {
            style: {
                backgroundColor:  (params.row.status == 0) ? "-sharp2d8cf0" :"-sharped3f14"

params.row is a single object of the current line. Just judge from the corresponding fields in this object

Menu