ivue组件Table不能在标签上用v-for,以下是通过百度之后自己实现的方法:
...
// 省略不重要的代码
render: (h, params) => {
let arr = params.row.groupColor;
return h(
"div",
{
style: {
display: "flex",
alignItems: "center",
justifyContent: "center"
}
},
arr.map((item, inde) => {
return h("div", {
style: {
background: item,
width: "10px",
height: "10px",
borderRadius: "50%",
marginRight: "3px"
}
});
})
);
}
...
实现的结果如下:两个小圆点是根据数组内容渲染得出,数组内容个数不定。