需求如下: 写一个css函数 :style="{ color: styleColorFn(item.projectType)}" styleColorFn(projectType) { switch(projectType) { case "图像分类": return "#fff"; case "物体检测": return "green"; defalut: return "red"; } }