我在本地存储图像中有对象数组
一些函数返回带有新数据的对象。我需要将新数据写入 localstorage 中的对象(通过 ID 标识)。
我试过了,但是......见我下面的代码
const result = {
type: 'mobile',
id: 'tsy152ivm',
score: 55
}
const links = JSON.parse(localStorage.getItem('links'));
const item = links.find(item => item.id === result.id);
//localStorage.setItem('links', JSON.stringify(item));
哆啦的时光机
相关分类