我这样设置:
chrome.storage.local.set({
myState: {
data: {
website: "google.com",
visited: false,
count: 0
}
}
})
如果我想将myState.data.visited更改为true,我该怎么办?
答案 0 :(得分:1)
您需要获取数据,更改数据并再次保存。
chrome.storage.local.get('storageKey', function(result) {
//data.visited will be in the result object for a specific key. You can change data.visited
//to be true here. After changing it to true you can save it again under
//the key 'storageKey' or any key you like.
chrome.storage.local.set({storageKey: result});
});