diff --git a/pages/columnGoods/goods_search/index.vue b/pages/columnGoods/goods_search/index.vue index 6478b9e..636cad2 100644 --- a/pages/columnGoods/goods_search/index.vue +++ b/pages/columnGoods/goods_search/index.vue @@ -294,10 +294,13 @@ }, searchBut: function() { if(this.searchValue!='') { - this.historyList.unshift({ + let t = this.historyList.findIndex(item=>item.word==this.searchValue); + let list = [...this.historyList]; + if(t!=-1) list.splice(t, 1); + list.unshift({ word: this.searchValue }); - uni.setStorageSync('historyList', this.historyList); + uni.setStorageSync('historyList', list); } if (this.back) { return uni.navigateBack({