
我自己加了一下,没有加什么配置,就利用注释解析一下,希望作者能加上一下。
在historys里加了name属性,如果解析到//code_name:的注释,就用注释的名字,否则就用原来的timeStamp。
this.historys = res.map((item: any) => ({
id: item._id,
timeStamp: parseInt(item._id.split('/')[1]),
code: item.data,
name: this.parseCodeName(item._id,item.data)
}))
parseCodeName(id:string,code:string):string{
let matches= code.match(/\/\/code_name:(.+)/i);
let name=matches?matches[1]:formatTime(parseInt(id.split('/')[1]));
return name;
}