Commit 5cebab15 by 冷斌

fix bug

parent ad34e940
...@@ -291,7 +291,7 @@ ...@@ -291,7 +291,7 @@
cacheKeyWorlds:function () { cacheKeyWorlds:function () {
let item = localStorage.getItem("search"); let item = localStorage.getItem("search");
//['考研课程', '事业单位考试', '公务员考试']; //['考研课程', '事业单位考试', '公务员考试'];
return item ? item : []; return item ? JSON.parse(item) : [];
} }
}, },
methods: { methods: {
...@@ -423,7 +423,7 @@ ...@@ -423,7 +423,7 @@
let item = localStorage.getItem("search"); let item = localStorage.getItem("search");
console.log(item); console.log(item);
//['考研课程', '事业单位考试', '公务员考试']; //['考研课程', '事业单位考试', '公务员考试'];
let data = item ? item : []; let data = item ? JSON.parse(item) : [];
console.log(data); console.log(data);
if (data.indexOf(this.keyword) < 0) { if (data.indexOf(this.keyword) < 0) {
data.push(this.keyword); data.push(this.keyword);
...@@ -433,7 +433,7 @@ ...@@ -433,7 +433,7 @@
data.shift(); data.shift();
} }
console.log(data); console.log(data);
localStorage.setItem("search", data); localStorage.setItem("search", JSON.stringify(data));
} }
} }
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment