From c00320c6fd6c1b0cc845316f9750c60fc1cd97ed Mon Sep 17 00:00:00 2001 From: wally <18603454788@163.com> Date: Thu, 28 Oct 2021 09:57:34 +0800 Subject: [PATCH] feat: menu --- src/App.vue | 45 +++++++++++++-- src/components/navbar.vue | 22 ++++++- src/routers/index.js | 19 ++---- src/store/index.js | 11 +++- src/views/data-history.vue | 115 +++++++++++++++++++------------------ src/views/device-list.vue | 4 +- src/views/test.vue | 2 +- 7 files changed, 136 insertions(+), 82 deletions(-) diff --git a/src/App.vue b/src/App.vue index 78ed659..dc7d3a1 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,15 +1,20 @@ + diff --git a/src/routers/index.js b/src/routers/index.js index 7d35ee3..6aeff09 100644 --- a/src/routers/index.js +++ b/src/routers/index.js @@ -2,49 +2,42 @@ import { createRouter, createWebHistory } from 'vue-router'; // 还有 createWebHashHistory 和 createMemoryHistory export const routes = [ - { path: '/', redirect: '/test' }, { path: '/network-config', name: 'network-config', - meta: { title: '网络参数配置' }, + meta: { title: '网络参数配置', icon: 'el-icon-setting' }, component: () => import('@/views/network-config.vue'), }, { path: '/function-config', name: 'function-config', - meta: { title: '功能参数配置' }, + meta: { title: '功能参数配置', icon: 'el-icon-set-up' }, component: () => import('@/views/function-config.vue'), }, { path: '/device-create', name: 'device-create', - meta: { title: '设备添加' }, + meta: { title: '设备添加', icon: 'el-icon-plus' }, component: () => import('@/views/device-create.vue'), }, { path: '/devices', name: 'devices', - meta: { title: '设备管理' }, + meta: { title: '设备管理', icon: 'el-icon-box' }, component: () => import('@/views/device-list.vue'), }, { path: '/data-history', name: 'data-history', - meta: { title: '历史数据查看' }, + meta: { title: '历史数据查看', icon: 'el-icon-data-line' }, component: () => import('@/views/data-history.vue'), }, { path: '/months', name: 'months', - meta: { title: '月累计数据分析' }, + meta: { title: '月累计数据分析', icon: 'el-icon-data-analysis' }, component: () => import('@/views/month-data.vue'), }, - { - path: '/test', - name: 'test', - meta: { title: '测试' }, - component: () => import('@/views/test.vue'), - }, ]; const router = createRouter({ diff --git a/src/store/index.js b/src/store/index.js index 7238607..37706ae 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1,12 +1,17 @@ import { createStore } from 'vuex'; import device from './device'; -import user from './user'; import statistics from './statistics'; +import user from './user'; export default createStore({ modules: { user, device, statistics }, - state: {}, + state: { menu: { show: true, collapse: false } }, getters: {}, - mutations: {}, + mutations: { + toggleCollapse(state) { + console.log('1'); + state.menu.collapse = !state.menu.collapse; + }, + }, actions: {}, }); diff --git a/src/views/data-history.vue b/src/views/data-history.vue index c7a9853..f1d9251 100644 --- a/src/views/data-history.vue +++ b/src/views/data-history.vue @@ -1,36 +1,32 @@