|
@@ -44,6 +44,8 @@ import Ads from '@/components/Other/CarbonAds'
|
|
|
import LogoSvg from '../assets/logo.svg?inline'
|
|
|
// import logo1 from '../assets/logo-1.png'
|
|
|
import { asyncRouterMap } from '@/config/router.config.js'
|
|
|
+import router from '@/router'
|
|
|
+
|
|
|
export default {
|
|
|
name: 'BasicLayout',
|
|
|
components: {
|
|
@@ -90,22 +92,39 @@ export default {
|
|
|
computed: {
|
|
|
...mapState({
|
|
|
// 动态主路由
|
|
|
- mainMenu: state => state.permission.addRouters
|
|
|
+ mainMenu: state => state.permission.addRouters,
|
|
|
+ routers: state => state.permission.routers
|
|
|
})
|
|
|
},
|
|
|
+ watch: {
|
|
|
+ // mainMenu: {
|
|
|
+ // handler () {
|
|
|
+ // console.log('红菊地址', this.mainMenu)
|
|
|
+
|
|
|
+ // this.menus = this.mainMenu[0].children
|
|
|
+ // },
|
|
|
+ // deep: true
|
|
|
+ // }
|
|
|
+ },
|
|
|
created () {
|
|
|
- const routes = asyncRouterMap.find((item) => item.path === '/')
|
|
|
- // const routes = this.mainMenu.find(item => item.path === '/')
|
|
|
- this.menus = (routes && routes.children) || []
|
|
|
- // 处理侧栏收起状态
|
|
|
- this.$watch('collapsed', () => {
|
|
|
- this.$store.commit(SIDEBAR_TYPE, this.collapsed)
|
|
|
- })
|
|
|
- this.$watch('isMobile', () => {
|
|
|
- this.$store.commit(TOGGLE_MOBILE_TYPE, this.isMobile)
|
|
|
- })
|
|
|
+
|
|
|
},
|
|
|
mounted () {
|
|
|
+ this.$nextTick(() => {
|
|
|
+ const routes = asyncRouterMap.find((item) => item.path === '/')
|
|
|
+ // const routes = this.mainMenu.find(item => item.path === '/')
|
|
|
+ console.log('奇怪的路由:', this.mainMenu[0].children)
|
|
|
+ // this.menus = this.mainMenu[0].children
|
|
|
+ this.menus = (routes && routes.children) || []
|
|
|
+ // 处理侧栏收起状态
|
|
|
+ this.$watch('collapsed', () => {
|
|
|
+ this.$store.commit(SIDEBAR_TYPE, this.collapsed)
|
|
|
+ })
|
|
|
+ this.$watch('isMobile', () => {
|
|
|
+ this.$store.commit(TOGGLE_MOBILE_TYPE, this.isMobile)
|
|
|
+ })
|
|
|
+ })
|
|
|
+
|
|
|
const userAgent = navigator.userAgent
|
|
|
if (userAgent.indexOf('Edge') > -1) {
|
|
|
this.$nextTick(() => {
|