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);

相关内容

热门资讯

透视系统"wepok... 透视系统"wepoker手机助手"大菠萝免费辅助器(果然是真的辅助平台)-哔哩哔哩大菠萝免费辅助器能...
反观"wepoker... 反观"wepoker正确养号方法"wpk私人辅助(好像是有辅助工具)-哔哩哔哩1、wepoker正确...
记者获悉"wpk俱乐... 记者获悉"wpk俱乐部有没有辅助"hhpoker可以开挂吗(竟然是有辅助软件)-哔哩哔哩1、全新机制...
有消息称"hhpok... 有消息称"hhpoker透视工具"cloudpoker作必弊(果然真的有辅助下载)-哔哩哔哩1、不需...
辅助透视"wpk模拟... 辅助透视"wpk模拟器"wepoker辅助透视(竟然有辅助插件)-哔哩哔哩暗藏猫腻,小编详细说明we...
不少玩家反映"aap... 不少玩家反映"aapoker怎么设置抽水"wepoker公共底牌(竟然真的是有辅助安装)-哔哩哔哩1...
截至目前"wepok... 截至目前"wepoker作必弊方法"epoker透视(真是真的是有辅助辅助器)-哔哩哔哩1、wepo...
透视辅助"hhpok... 透视辅助"hhpoker免费辅助器"wepoker线上大神(一贯有辅助工具)-哔哩哔哩1、上手简单,...
透视代打"wepok... 透视代打"wepoker俱乐部辅助器"wepoker看底牌(本来真的是有辅助修改器)-哔哩哔哩1、玩...
今天上午"竞技联盟透... 今天上午"竞技联盟透视"德州局透视脚本免费版下载手机版(都是有辅助app)-哔哩哔哩1、实时德州局透...