觉醒时刻
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
juexingshike/assets/Scripts/SCommon/DataManageUtil.ts

33 lines
858 B

// add by shi
// 2023.5.31
// 注意功能: 根据列名获取列数据
const {ccclass, property} = cc._decorator;
@ccclass
export default class DataManageUtil {
public static getDataByDataCol(dataList, dataCol){
let data:any = {}
for(let i=0;i<dataList.length;i++){
if(dataList[i].dataCol == dataCol){
return dataList[i].dataVal;
}
}
return null;
}
public static setDataByDataCol(dataList, dataCol, dataVal){
let isFind = false;
for(let i=0;i<dataList.length;i++){
if(dataList[i].dataCol == dataCol){
isFind = true;
dataList[i].dataVal = dataVal;
}
}
if(!isFind){
dataList.push({dataCol:dataCol, dataVal:dataVal});
}
return dataList;
}
}