From 934b6bb137ea10a952558a0d13ed2798912b4999 Mon Sep 17 00:00:00 2001 From: jiannibang <271381693@qq.com> Date: Thu, 16 Mar 2023 12:00:46 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=89=8D=E7=AB=AF=E9=97=AE=E9=A2=98?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/Search/Search.vue | 4 +++- src/router/index.js | 24 +++++++++++------------- src/views/Index/Index.vue | 3 ++- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/components/Search/Search.vue b/src/components/Search/Search.vue index 987cc29..aba4229 100644 --- a/src/components/Search/Search.vue +++ b/src/components/Search/Search.vue @@ -222,6 +222,7 @@ function close() { width: 264px; margin-top: 40px; gap: 12px 24px; + align-items: start; } } .tabs-wrapper { @@ -289,7 +290,8 @@ function close() { white-space: nowrap; text-overflow: ellipsis; padding: 0 32px; - display: inline-flex; + display: inline-block; + max-width: 170px; align-items: center; } .medal { diff --git a/src/router/index.js b/src/router/index.js index b1293b6..31cc244 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -30,19 +30,17 @@ router.beforeEach(async to => { const { data, code } = res if (code === ERR_OK) { if (!router.hasRoute('home')) { - //推荐卡片列表长度为0时说明不需要推荐页面 直接从导航栏列表删除 - if (!data.columnList.length) { - store.SET_SIDEBAR_LIST(store.sidebarList.slice(1)) - } - //store存储的首页卡片数据长度不等于请求的卡片数据长度时才能去重新提交到store中 防止重复提交 - if (store.indexList?.columnList?.length !== data.columnList.length) { - const { - data: { searchList, recommendList } - } = await getQMGoShopData() - store.SET_INDEX_LIST({ ...data, recommendList, hotSearch: searchList }) - } - store.SET_SELECTED_MODULE(store.sidebarList[0].title) - router.addRoute(dynamicRoutes(data.columnList)) + const { + data: { searchList, recommendList } + } = await getQMGoShopData() + store.SET_INDEX_LIST({ ...data, recommendList, hotSearch: searchList }) + + router.addRoute({ + path: '/index', + name: 'home', + component: import(/* webpackChunkName: "Home" */ '@/views/Index/Index') + }) + return to.fullPath } } diff --git a/src/views/Index/Index.vue b/src/views/Index/Index.vue index fed58ce..7e10b9c 100644 --- a/src/views/Index/Index.vue +++ b/src/views/Index/Index.vue @@ -274,8 +274,9 @@ const handleFood = id => { white-space: nowrap; text-overflow: ellipsis; padding: 0 32px; - display: inline-flex; + display: inline-block; align-items: center; + max-width: 176px; } .medal {