let knowledgeData =[]; let initialKnowledge = [ [ ["id", 1], ["title", "關(guān)于float的那些事兒"], ["URL", "http://www.w3school.com.cn/cssref/pr_class_float.asp"], ["progress", 100], ["evaluation", 3], ["notes", "關(guān)于float的那些事兒關(guān)于float的那些事兒關(guān)于float的那些事兒關(guān)于float的那些事兒關(guān)于float的那些事兒關(guān)于float的那些事兒"], ["tags", ["1", "2", "3"]] ], [ ["id", 2], ["title", "position知多少"], ["URL", "http://www.w3school.com.cn/cssref/pr_class_position.asp"], ["progress", 75], ["evaluation", 4], ["notes", "position知多少position知多少position知多少position知多少position知多少position知多少position知多少position知多少position知多少"], ["tags", ["1", "2"]] ], [ ["id", 3], ["title", "1211gfdhfnndhdfhdfgfd"], ["URL", "http://www.w3school.com.cn/cssref/pr_class_position.asp"], ["progress", 66], ["evaluation", 2], ["notes", "gfgitiongdfgfdh42356576654435u6uyuydhfjyrdjfjyrdhhvjtdyrdhhmvjdhhmvhthhgchvjyhmhvjyhdgmhvhyedtjfhjyyedtjykkfuuysjx"], ["tags", ["2", "3"]] ] ]; for (let knowledge of initialKnowledge) { knowledgeData.push(new Map(knowledge)); } localStorage.setItem("knowledgeData", JSON.stringify(knowledgeData));遇到問題:現(xiàn)在將knowledgeData這個數(shù)組轉(zhuǎn)換成JSON字符串存到localStorage中,再使用JSON.parse(localStorage.getItem("knowledgeData"))取出,是空的,不知道為什么?是因為使用了Map的原因嗎?求大神解答
有關(guān)JSON.stringify( )的問題
慕尼黑8549860
2019-03-14 18:15:59