From b64efac97f091970c98348a501b8846f2faa17d4 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?TOP=E7=B3=AF=E7=B1=B3?= <1130395124@qq.com>
Date: Sun, 19 Mar 2023 13:58:40 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=88=86=E7=B1=BB=E6=90=9C?=
=?UTF-8?q?=E7=B4=A2?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/widgets/search.vue | 7 ++++++-
src/pages/index/index.vue | 2 +-
src/pages/service/cate.vue | 27 ++++++++++++++++++++++++++-
3 files changed, 33 insertions(+), 3 deletions(-)
diff --git a/src/components/widgets/search.vue b/src/components/widgets/search.vue
index 3738214..5d12323 100644
--- a/src/components/widgets/search.vue
+++ b/src/components/widgets/search.vue
@@ -6,7 +6,7 @@
@@ -25,6 +25,11 @@ export default {
created() {},
mounted() {},
destroyed() {},
+ watch: {
+ keywords(value) {
+ this.$emit("input", value);
+ },
+ },
methods: {},
};
diff --git a/src/pages/index/index.vue b/src/pages/index/index.vue
index c44de6b..c6ac445 100644
--- a/src/pages/index/index.vue
+++ b/src/pages/index/index.vue
@@ -1,6 +1,6 @@
-
+
diff --git a/src/pages/service/cate.vue b/src/pages/service/cate.vue
index e97cc0b..71aa00d 100644
--- a/src/pages/service/cate.vue
+++ b/src/pages/service/cate.vue
@@ -1,7 +1,7 @@
-
+
{
response.data.forEach((item) => {
list.push({
@@ -123,6 +128,9 @@ export default {
loadCate() {
this.$request({
api: "service.cate",
+ data: {
+ keys: this.keywords,
+ },
})
.then((response) => {
response.data.forEach((item) => {
@@ -151,6 +159,23 @@ export default {
this.newId = parentId;
this.$utils.toPage("/pages/service/list?id=" + id);
},
+ /**
+ * 搜索
+ */
+ inputKeywords(kw) {
+ this.keywords = kw;
+ clearTimeout(this.keywordsTimer);
+ this.keywordsTimer = setTimeout(async () => {
+ this.data = [];
+ this.data.push({
+ id: 0,
+ name: "热门推荐",
+ cover: "",
+ child: await this.hotCate(),
+ });
+ this.loadCate();
+ }, 1000);
+ },
},
};