|
@@ -17,17 +17,36 @@
|
|
|
import { onMounted, ref } from 'vue'
|
|
|
import { getStore } from 'hc-vue3-ui'
|
|
|
import HcMenuBar from '~src/layout/modules/MenuBar.vue'
|
|
|
+import { getArrValue, isNullES } from 'js-fast-way'
|
|
|
|
|
|
//左侧菜单
|
|
|
const menuKey = ref('')
|
|
|
-const menuData = getStore('projectMenu')
|
|
|
+const menuData = ref([])
|
|
|
const menuChange = (data) => {
|
|
|
console.log(data)
|
|
|
}
|
|
|
|
|
|
+//渲染完成
|
|
|
onMounted(() => {
|
|
|
-
|
|
|
+ getMenuDataKey()
|
|
|
})
|
|
|
+
|
|
|
+//获取菜单数据
|
|
|
+const getMenuDataKey = async () => {
|
|
|
+ const menu = getArrValue(getStore('projectMenu'))
|
|
|
+ menuData.value = menu
|
|
|
+ menuKey.value = await getMenuDefaultKey(menu)
|
|
|
+}
|
|
|
+
|
|
|
+//获取菜单默认key
|
|
|
+const getMenuDefaultKey = async (data) => {
|
|
|
+ const children = data[0].children
|
|
|
+ if (!isNullES(children) && children.length > 0) {
|
|
|
+ return await getMenuDefaultKey(children)
|
|
|
+ } else {
|
|
|
+ return data[0].code
|
|
|
+ }
|
|
|
+}
|
|
|
</script>
|
|
|
|
|
|
<style lang="scss">
|