Commit f8e331b5 by 冷斌

fix bug

parent 92b8ed70
...@@ -421,14 +421,18 @@ ...@@ -421,14 +421,18 @@
}, },
searchSave: function () { searchSave: function () {
let item = localStorage.getItem("search"); let item = localStorage.getItem("search");
console.log(item);
//['考研课程', '事业单位考试', '公务员考试']; //['考研课程', '事业单位考试', '公务员考试'];
let data = item.length > 0 ? item : []; let data = item.length > 0 ? 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", data); localStorage.setItem("search", 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