From f76c71c95082ea1bd4d084357f9f14c15e23ea8f Mon Sep 17 00:00:00 2001 From: haiyangcui Date: Thu, 13 Aug 2020 21:46:23 +0200 Subject: [PATCH] Merge searchClickEvent and searchEvent --- src/components/Film.vue | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/src/components/Film.vue b/src/components/Film.vue index c84a9a0..f158d49 100644 --- a/src/components/Film.vue +++ b/src/components/Film.vue @@ -18,10 +18,10 @@
-
+
    -
  • {{i.keywords}}
  • +
  • {{i.keywords}}
  • 清空历史记录
@@ -378,8 +378,8 @@ export default { this.searchList = res.reverse() }) }, - searchEvent () { - const wd = this.searchTxt + searchEvent (wd) { + this.searchTxt = wd this.searchContents = [] this.pagecount = 0 this.show.search = false @@ -412,29 +412,6 @@ export default { }) } }, - searchClickEvent (e) { - this.searchContents = [] - this.pagecount = 0 - this.searchTxt = e.keywords - this.show.search = false - this.show.find = true - search.remove(e.id).then(res => { - search.add({ keywords: e.keywords }) - this.getAllSearch() - }) - zy.search(this.site.key, e.keywords).then(res => { - const type = Object.prototype.toString.call(res) - if (type === '[object Undefined]') { - this.$message.info('无搜索结果') - } - if (type === '[object Array]') { - this.searchContents.push(...res) - } - if (type === '[object Object]') { - this.searchContents.push(res) - } - }) - }, clearSearch () { search.clear().then(res => { this.getAllSearch()