AngularMatStepper无法识别两个字符串数组中的缓存值(但可以成功识别另一个字符串数组的值)
创始人
2024-10-28 12:01:20
0

将需要缓存的字符串数组转换为对象数组,然后通过维护对象数组来保存缓存值。以下是代码示例:

在组件中定义对象数组:

cachedValues = [{id: 'array1', values: []}, {id: 'array2', values: []}, {id: 'array3', values: []}];

在需要缓存的地方,从字符串数组转换为对象数组:

const newArray1 = arr1.map((val) => {return {value: val};});
const newArray2 = arr2.map((val) => {return {value: val};});
const newArray3 = arr3.map((val) => {return {value: val};});

this.cachedValues[0].values = newArray1;
this.cachedValues[1].values = newArray2;
this.cachedValues[2].values = newArray3;

在需要使用缓存值的地方,从对象数组转换为字符串数组:

const cachedArr1 = this.cachedValues[0].values.map((obj) => obj.value);
const cachedArr2 = this.cachedValues[1].values.map((obj) => obj.value);
const cachedArr3 = this.cachedValues[2].values.map((obj) => obj.value);

相关内容

热门资讯

更值得关注的是!wepoker... 更值得关注的是!wepoker私人局辅助器怎么用(透视)本来有辅助软件(有人有挂)-哔哩哔哩1、we...
透视代打!we poker游戏... 透视代打!we poker游戏下(透视)其实是真的辅助插件(有挂解密)-哔哩哔哩一、we poker...
昨日!aapoker俱乐部靠谱... 昨日!aapoker俱乐部靠谱吗(透视)竟然有辅助插件(有挂工具)-哔哩哔哩1、aapoker俱乐部...
透视美元局!如何下载wepok... 透视美元局!如何下载wepoker安装包(透视)确实是有辅助平台(有挂教程)-哔哩哔哩1、如何下载w...
透视挂透视!wepoker怎么... 透视挂透视!wepoker怎么开辅助(透视)切实是有辅助安装(有挂助手)-哔哩哔哩1、这是跨平台的w...
透视苹果版!pokemomo辅... 透视苹果版!pokemomo辅助软件(透视)一贯是真的辅助修改器(的确有挂)-哔哩哔哩1、玩家可以在...
随着!约局吧德州真的有透视挂吗... 随着!约局吧德州真的有透视挂吗(透视)一直是有辅助平台(有挂详情)-哔哩哔哩1、打开软件启动之后找到...
经核实!约局吧德州真的存在透视... 经核实!约局吧德州真的存在透视吗(透视)都是有辅助app(有挂方法)-哔哩哔哩1)约局吧德州真的存在...
昨日!steampokerma... 昨日!steampokermaster辅助(透视)本来是真的辅助安装(有挂分析)-哔哩哔哩1、超多福...
透视攻略!wepoker究竟有... 透视攻略!wepoker究竟有没有透视(透视)切实真的有辅助插件(有挂详细)-哔哩哔哩1、该软件可以...