Commit e5fb1e96 by 冷斌

fix bug

parent 5cebab15
...@@ -421,19 +421,16 @@ ...@@ -421,19 +421,16 @@
}, },
searchSave: function () { searchSave: function () {
let item = localStorage.getItem("search"); let item = localStorage.getItem("search");
console.log(item);
//['考研课程', '事业单位考试', '公务员考试']; //['考研课程', '事业单位考试', '公务员考试'];
let data = item ? JSON.parse(item) : []; let data = item ? JSON.parse(item) : [];
console.log(data);
if (data.indexOf(this.keyword) < 0) { if (data.indexOf(this.keyword) < 0) {
data.push(this.keyword); data.push(this.keyword);
} }
console.log(data);
if (data.length > 8) { if (data.length > 8) {
data.shift(); data.shift();
} }
console.log(data);
localStorage.setItem("search", JSON.stringify(data)); localStorage.setItem("search", JSON.stringify(data));
this.cacheKeyWorlds();
} }
} }
}) })
......
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