methods: {
searchAll() {
if (this.state1 !== '') {
var templist = JSON.parse(localStorage.getItem("msgBody") || "[]");
templist.map((item, index) => {
if (item.value == this.state1) {
templist.splice(index, 1);
}
});
templist.unshift({
"value": this.state1
});
localStorage.setItem("msgBody", JSON.stringify(templist));
console.log("取数组", this.items)
}
}
取数据
mounted() {
this.restaurants = JSON.parse(localStorage.getItem("msgBody"));
}