效果图
代码
html
<div :style="`${item.secondary === `${maxB1}` ? 'color:red;' : ''}`">{{ item.secondary }}</div>
js
data里面定义
maxB1
methods里面
var arr = [];//定义一个空数组
var reg =/[\u4e00-\u9fa5]/g;//去掉中文
this.allstitutionVa.forEach((i)=>{
//this.allstitutionVa这个是你的数组里面的值
arr.push(i.apropos.replace(reg, "")); })//这个是得到其中一行对应的值 放在数组里面
this.maxB1 = arr.sort(function(a,b){
//这个this.maxB1是data里面定义的值
// 以下是判断大小值
return b-a;
})[0];
//这边可以打印看下是否显示最大值了
//然后让得到的值与数据渲染的值一致时就是最大显示对应颜色