-
Notifications
You must be signed in to change notification settings - Fork 549
Closed
Description
readme 中提到 LocalStorage 但可以在多補充一些細節。
使用 localStorage 的时候,直接把 items 传入得到的值是 [object Object]
這樣的原因是因為 local storage 裡面只會儲存 string 型別,如果傳入的非 string 會直接使用 toString 轉換
({}).toString() //"[object Object]"
這時候就會發生異常,所以才需要先使用 JSON.stringify() 將 object 轉換成 json 格式,讀取出來之後在利用 JSON.parse 轉換為 object
soyaine
Metadata
Metadata
Assignees
Labels
No labels