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(透视)开挂辅助插件(总是存在有挂)-哔哩哔哩运安装不了wepoker...
透视智能ai!hhpoker辅... 您好,wepoker怎么获得好牌这款游戏可以开挂的,确实是有挂的,需要了解加去威信【48527505...
透视稳定!xpoker辅助工具... 透视稳定!xpoker辅助工具(透视)开挂辅助技巧(本来是有挂)-哔哩哔哩该软件可以轻松地帮助玩家将...
辅助透视!xpoker辅助工具... 辅助透视!xpoker辅助工具,wepoker私人局有透视吗,法子教程(总是真的是有挂)-哔哩哔哩1...
透视透视!德普之星透视,hhp... 透视透视!德普之星透视,hhpoker视频巡查真的假的,手段教程(本来真的是有挂)-哔哩哔哩1.hh...
透视总结!wepoker透视脚... 透视总结!wepoker透视脚本免费app(透视)开挂辅助工具(确实是真的挂)-哔哩哔哩1、进入游戏...
透视实锤!佛手大菠萝辅助,so... 透视实锤!佛手大菠萝辅助,sohoo poker辅助器,秘籍教程(原来是有挂)-哔哩哔哩;1、佛手大...
透视测试!hhpoker德州透... 透视测试!hhpoker德州透视(透视)开挂辅助方法(原来是真的挂)-哔哩哔哩1、hhpoker德州...
透视软件!wepoker挂,德... 透视软件!wepoker挂,德普之星透视辅助,总结教程(切实真的有挂)-哔哩哔哩1、下载好德普之星透...
透视ai代打!aapoker发... 透视ai代打!aapoker发牌逻辑(透视)开挂辅助神器(竟然有挂)-哔哩哔哩aapoker发牌逻辑...