根据后端返回字段显示不同的颜色

需求如下:

在这里插入图片描述

写一个css函数

:style="{ color: styleColorFn(item.projectType)}"
styleColorFn(projectType) {
	switch(projectType) {
		case "图像分类":
			return "#fff";
		case "物体检测":
			return "green";
		defalut:
			return "red";
 	}
}

猜你喜欢

转载自blog.csdn.net/weixin_44700978/article/details/125342192
今日推荐