我有一个本地存储项目,如下所示
(2) [{…}, {…}]
0
:
cityName
:
"durban"
__proto__
:
Object
1
:
cityName
:
"cape town"
__proto__
:
Object
我想根据cityName是否与本地存储项匹配来删除1项,即如果用户点击" durban"然后删除德班。
我已经能够从点击中获取名称
deleteCity(event){
var target = event.currentTarget.id;
console.log(target);
var getLSCityName = localStorage.getItem('savedLocations');
var getLSCityNameArr = JSON.parse(getLSCityName);
for(var i = 0; i < getLSCityNameArr.length; i++){
if (getLSCityNameArr[i].cityName == target){
getLSCityNameArr.splice[i].cityName;
localStorage.setItem('savedLocations', JSON.stringify(getLSCityNameArr));
}
}
}
答案 0 :(得分:2)
pydicom.filewriter.dcmwrite