[英]localstorage.getItem shows only one data although there is more than one data in the array
尽管数组项数组中存储了多个数据,但它仅显示最近添加的数据。 这可能是什么原因? 预先感谢您对我们的支持
// List items
const array_item = JSON.parse(localStorage.getItem("array_item") || "[]");
array_item.forEach(function(item,index,array){
const output = '<div class="bg-card p-2" style="font-size:14px;"><div class="container"><strong>Okunmadı olarak işaretlediğin makale:</strong> <a href="<?=PROOT?>home/details/'+item.sef_link +'">'+item.title+'</a></div></div>';
console.log(array);
document.getElementById("mark").innerHTML = output;
});
const array_item = JSON.parse(localStorage.getItem("array_item") || "[]");
array_item.forEach(function(item,index,array){
const output = '<div class="bg-card p-2" style="font-size:14px;"><div class="container"><strong>Okunmadı olarak işaretlediğin makale:</strong> <a href="<?=PROOT?>home/details/'+item.sef_link +'">'+item.title+'</a></div></div>';
console.log(array);
document.getElementById("mark").innerHTML += output;
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.