From c0e1a257fba6fd94fb5ee3876023713146d21c7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E5=BE=81?= Date: Tue, 10 May 2022 11:23:57 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E6=94=B9=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/UiGoodsItem.vue | 2 +- layouts/module/header/index.vue | 7 ++++++- pages/goods/list/index.vue | 13 +++++++++++-- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/components/UiGoodsItem.vue b/components/UiGoodsItem.vue index c910e77..a9d94b9 100644 --- a/components/UiGoodsItem.vue +++ b/components/UiGoodsItem.vue @@ -75,7 +75,7 @@ export default { -webkit-line-clamp: 2; &-label { display: inline-block; - padding: 4px 8px; + padding: 2px 8px; background: rgba(255, 135, 91, 0.1); font-size: 12px; font-family: Microsoft YaHei-Regular, Microsoft YaHei; diff --git a/layouts/module/header/index.vue b/layouts/module/header/index.vue index 5a861ac..02d4732 100644 --- a/layouts/module/header/index.vue +++ b/layouts/module/header/index.vue @@ -244,7 +244,12 @@ export default { }, onSearch() { // 储存搜索内容 - this.$router.push("/goods/list"); + this.$router.push({ + path: "/goods/list", + query: { + keyword: this.searchContent, + }, + }); }, }, }; diff --git a/pages/goods/list/index.vue b/pages/goods/list/index.vue index cd6fe83..85c191f 100644 --- a/pages/goods/list/index.vue +++ b/pages/goods/list/index.vue @@ -46,7 +46,7 @@ class="main__pagination flex flex-right" @current-change="handleCurrentChange" :current-page.sync="params.pageIndex" - :page-size="100" + :page-size="20" layout="prev, pager, next, jumper" :total="total" > @@ -77,6 +77,7 @@ export default { }; }, async created() { + this.params.name = this.$route.query.keyword; this.getGoodsListData(); }, methods: { @@ -125,6 +126,14 @@ export default { vm.getGoodsListData(); }, }, + watch: { + //监听路由 + //监听路由的categoryId属性的数据变化 + "$route.query.keyword": function () { + this.params.name = this.$route.query.keyword; + this.getGoodsListData(); + }, + }, }; \ No newline at end of file +