From d4b085b054e9187eaf937be70f4cdd3f16aa50cd Mon Sep 17 00:00:00 2001 From: wangqiujuan0808 <578331299@qq.com> Date: Mon, 30 Oct 2023 18:14:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit f --- src/components/Header.vue | 10 +++++++--- src/components/Menus.vue | 29 ++++++++++++++++++----------- src/store/index.js | 6 +++++- src/views/Green.vue | 2 +- src/views/Home.vue | 3 +++ src/views/Weather.vue | 2 +- 6 files changed, 35 insertions(+), 17 deletions(-) diff --git a/src/components/Header.vue b/src/components/Header.vue index 03ed0a7..94a00e4 100644 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -2,7 +2,7 @@
- {{ name }} + {{ modelName }}
{ const pathname = window.location.hash.split('/')[1] || '' @@ -63,7 +66,8 @@ export default { router.afterEach((to) => { console.log('to', to) const { id } = to.query - state.name = pathMap[to.name] + state.name = pathMap[to.name]; + state.modelName = store.state.modelName; // state.hasBack = ['level2', 'level3', 'order_detail'].includes(to.name) }) return { diff --git a/src/components/Menus.vue b/src/components/Menus.vue index fa6e8f7..3d8b1c7 100644 --- a/src/components/Menus.vue +++ b/src/components/Menus.vue @@ -1,6 +1,13 @@ @@ -10,25 +17,25 @@ import { useRouter } from "vue-router"; export default { name: "Header", props: ["pactiveI", "menus"], - setup(props, ctx) { + setup(props, ctx) { const router = useRouter(); const state = reactive({ activeI: 0, - menus: [] + menus: [], }); onMounted(() => { if (props.pactiveI) { state.activeI = props.pactiveI; - state.menus = props.menus + state.menus = props.menus; } }); - + const go = (i) => { ctx.emit("changeIndex", i); }; return { ...toRefs(state), - go + go, }; }, }; @@ -45,7 +52,7 @@ ul { flex-direction: column; justify-content: space-between; align-items: center; - + li { width: 100%; text-align: center; @@ -54,11 +61,11 @@ ul { display: flex; align-items: center; justify-content: center; - box-shadow: 0 0 8px #99ACB0 inset; + box-shadow: 0 0 8px #99acb0 inset; border-radius: 5px; - &.active-menu - { - background:#A7DCF5; + font-size: 24px; + &.active-menu { + background: #a7dcf5; } } } diff --git a/src/store/index.js b/src/store/index.js index 1fc54dc..8ce27fe 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -7,7 +7,8 @@ const store = createStore({ currentPath: '', userInfo: {}, selectDate: 0, - selectTab: 'old' + selectTab: 'old', + modelName: '' }, mutations: { updateCurrentPath(state, path) { @@ -22,6 +23,9 @@ const store = createStore({ changeSelectTab(state, data) { state.selectTab = data; }, + setModelName(state, data) { + state.modelName = data; + } }, actions: { updateCurrentPath({ commit }, path) { diff --git a/src/views/Green.vue b/src/views/Green.vue index 6e67cab..238d04b 100644 --- a/src/views/Green.vue +++ b/src/views/Green.vue @@ -42,7 +42,7 @@ export default { name: '数据分析', }, { - name: '历史数据', + name: '数据记录', } ], }) diff --git a/src/views/Home.vue b/src/views/Home.vue index a098bea..8891deb 100644 --- a/src/views/Home.vue +++ b/src/views/Home.vue @@ -16,10 +16,12 @@