diff --git a/src/components/common-form-control/index.vue b/src/components/common-form-control/index.vue
index 58abb96..d175ad4 100644
--- a/src/components/common-form-control/index.vue
+++ b/src/components/common-form-control/index.vue
@@ -49,7 +49,6 @@ const inputType = computed(() => {
})
const modelAttrs = computed(() => {
- console.info(inputType.value)
if (['input', 'select', 'autocomplete', 'cascader'].includes(props.option.type || 'input')) {
return Object.assign({ clearable: true }, props.option.attrs || {})
}
@@ -68,14 +67,12 @@ const formModel = computed(() => props.option.model || props.model)
const modelValue = computed({
get () {
- console.info('=================', formModel.value)
if (formModel.value && props.option.prop) {
return formModel.value[props.option.prop]
}
return null
},
set (val) {
- console.info('set===============', formModel.value)
if (formModel.value && props.option.prop) {
formModel.value[props.option.prop] = val
}
diff --git a/src/layout/LeftMenu.vue b/src/layout/LeftMenu.vue
index 5127ba8..d5de0fb 100644
--- a/src/layout/LeftMenu.vue
+++ b/src/layout/LeftMenu.vue
@@ -1,8 +1,8 @@
@@ -10,7 +10,7 @@ const businessMenus = useBusinessMenus()
diff --git a/src/layout/TopNav.vue b/src/layout/TopNav.vue
index e5423e2..0a5680f 100644
--- a/src/layout/TopNav.vue
+++ b/src/layout/TopNav.vue
@@ -1,17 +1,18 @@
diff --git a/src/services/global/GlobalService.js b/src/services/global/GlobalService.js
index 2ab5afc..a2ee411 100644
--- a/src/services/global/GlobalService.js
+++ b/src/services/global/GlobalService.js
@@ -1,11 +1,10 @@
import { GlobalLocales } from '@/consts/GlobalConstants'
import { useGlobalConfigStore } from '@/stores/GlobalConfigStore'
-import { ref } from 'vue'
-import { $i18nBundle } from '@/messages'
+import { loadBusinessMenus } from '@/services/mock/MockGlobalService'
export const useBaseTopMenus = () => {
const globalConfigStore = useGlobalConfigStore()
- return ref([
+ return [
{
iconIf: () => globalConfigStore.isCollapseLeft ? 'expand' : 'fold',
click: globalConfigStore.collapseLeft
@@ -58,71 +57,9 @@ export const useBaseTopMenus = () => {
}
]
}
- ])
+ ]
}
export const useBusinessMenus = () => {
- return ref([
- {
- icon: 'HomeFilled',
- index: '/',
- labelIf: () => $i18nBundle('common.label.title')
- },
- {
- icon: 'setting',
- labelKey: 'menu.label.systemManagement',
- children: [
- {
- index: '/admin/users',
- icon: 'user',
- labelKey: 'menu.label.userManagement'
- },
- {
- index: '/admin/roles',
- icon: 'GroupFilled',
- labelKey: 'menu.label.roleManagement'
- },
- {
- index: '/admin/authority',
- icon: 'lock',
- labelKey: 'menu.label.authorityManagement'
- },
- {
- index: '/admin/menus',
- icon: 'menu',
- labelKey: 'menu.label.menuManagement'
- }
- ]
- },
- {
- icon: 'BuildFilled',
- labelKey: 'menu.label.toolsManagement',
- children: [
- {
- index: '/not-found',
- icon: 'WarningFilled',
- labelKey: 'menu.label.errorPage404'
- },
- {
- index: '/icons',
- icon: 'InsertEmoticonOutlined',
- labelKey: 'menu.label.toolsIcons'
- },
- {
- index: '/forms',
- icon: 'TableRowsFilled',
- labelKey: 'menu.label.toolsForms'
- },
- {
- index: '/tables',
- icon: 'Grid',
- labelKey: 'menu.label.toolsTables'
- },
- {
- index: '/tests',
- icon: 'TipsAndUpdatesOutlined',
- labelKey: 'menu.label.toolsTests'
- }
- ]
- }])
+ return loadBusinessMenus()
}
diff --git a/src/services/mock/MockGlobalService.js b/src/services/mock/MockGlobalService.js
new file mode 100644
index 0000000..bdfd9d9
--- /dev/null
+++ b/src/services/mock/MockGlobalService.js
@@ -0,0 +1,76 @@
+import { $i18nBundle } from '@/messages'
+
+/**
+ * 测试假数据
+ * @returns {Promise}
+ */
+export const loadBusinessMenus = () => {
+ // 模拟加载业务数据
+ return new Promise((resolve, reject) => {
+ setTimeout(() => {
+ resolve([
+ {
+ icon: 'HomeFilled',
+ index: '/',
+ labelIf: () => $i18nBundle('common.label.title')
+ },
+ {
+ icon: 'setting',
+ labelKey: 'menu.label.systemManagement',
+ children: [
+ {
+ index: '/admin/users',
+ icon: 'user',
+ labelKey: 'menu.label.userManagement'
+ },
+ {
+ index: '/admin/roles',
+ icon: 'GroupFilled',
+ labelKey: 'menu.label.roleManagement'
+ },
+ {
+ index: '/admin/authority',
+ icon: 'lock',
+ labelKey: 'menu.label.authorityManagement'
+ },
+ {
+ index: '/admin/menus',
+ icon: 'menu',
+ labelKey: 'menu.label.menuManagement'
+ }
+ ]
+ },
+ {
+ icon: 'BuildFilled',
+ labelKey: 'menu.label.toolsManagement',
+ children: [
+ {
+ index: '/not-found',
+ icon: 'WarningFilled',
+ labelKey: 'menu.label.errorPage404'
+ },
+ {
+ index: '/icons',
+ icon: 'InsertEmoticonOutlined',
+ labelKey: 'menu.label.toolsIcons'
+ },
+ {
+ index: '/forms',
+ icon: 'TableRowsFilled',
+ labelKey: 'menu.label.toolsForms'
+ },
+ {
+ index: '/tables',
+ icon: 'Grid',
+ labelKey: 'menu.label.toolsTables'
+ },
+ {
+ index: '/tests',
+ icon: 'TipsAndUpdatesOutlined',
+ labelKey: 'menu.label.toolsTests'
+ }
+ ]
+ }])
+ })
+ })
+}
diff --git a/src/stores/MenuStore.js b/src/stores/MenuStore.js
new file mode 100644
index 0000000..9baa7dc
--- /dev/null
+++ b/src/stores/MenuStore.js
@@ -0,0 +1,28 @@
+import { defineStore } from 'pinia'
+import { ref } from 'vue'
+import { useBaseTopMenus, useBusinessMenus } from '@/services/global/GlobalService'
+
+export const useMenuStore = defineStore('menu', () => {
+ /**
+ * @type {[CommonMenuItem]}
+ */
+ const baseTopMenus = ref([])
+ /**
+ * @type {[CommonMenuItem]}
+ */
+ const businessMenus = ref([])
+ return {
+ baseTopMenus,
+ businessMenus,
+ loadBaseTopMenus () {
+ baseTopMenus.value = useBaseTopMenus()
+ console.info('顶部数据', businessMenus.value)
+ },
+ async loadBusinessMenus () {
+ businessMenus.value = await useBusinessMenus()
+ console.info('菜单数据', businessMenus.value)
+ }
+ }
+}, {
+ persist: true
+})
diff --git a/src/views/HomeView.vue b/src/views/HomeView.vue
index b7b52a9..2f11f80 100644
--- a/src/views/HomeView.vue
+++ b/src/views/HomeView.vue
@@ -3,14 +3,18 @@ import LeftMenu from '@/layout/LeftMenu.vue'
import TopNav from '@/layout/TopNav.vue'
import { useGlobalConfigStore } from '@/stores/GlobalConfigStore'
import { useTabsViewStore } from '@/stores/TabsViewStore'
+import { useMenuStore } from '@/stores/MenuStore'
import { GlobalLayoutMode } from '@/consts/GlobalConstants'
import { computed } from 'vue'
import GlobalSettings from '@/views/components/global/GlobalSettings.vue'
const globalConfigStore = useGlobalConfigStore()
+const menuStore = useMenuStore()
const tabsViewStore = useTabsViewStore()
const showLeftMenu = computed(() => {
return globalConfigStore.layoutMode === GlobalLayoutMode.LEFT
})
+menuStore.loadBaseTopMenus()
+menuStore.loadBusinessMenus()