feat: route
This commit is contained in:
parent
3b69e58ed7
commit
7adddbcab4
|
|
@ -1,4 +1,5 @@
|
|||
<template>
|
||||
<div></div>
|
||||
<div>
|
||||
<slot/>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -9,7 +9,10 @@
|
|||
</d2-flex>
|
||||
<!-- body -->
|
||||
<div class="layout__body">
|
||||
<router-view/>
|
||||
<d2-admin-layout-dashboard-container v-if="!isCustomBody">
|
||||
<router-view/>
|
||||
</d2-admin-layout-dashboard-container>
|
||||
<router-view v-else/>
|
||||
</div>
|
||||
<!-- header -->
|
||||
<div class="layout__header-background layout__blur"/>
|
||||
|
|
@ -41,7 +44,10 @@
|
|||
|
||||
<script>
|
||||
import { makeNameByUrl, makeClassNameByUrl } from 'd2/utils/component.js'
|
||||
import { get } from 'lodash-es'
|
||||
import { storeToRefs } from 'pinia'
|
||||
import { computed } from 'vue'
|
||||
import { useRoute } from 'vue-router'
|
||||
import { useD2AdminLayoutDashboardStore } from 'd2/components/d2/admin/layout/dashboard/store/index.js'
|
||||
import { useD2AdminUserStore } from 'd2/store/user.js'
|
||||
|
||||
|
|
@ -63,10 +69,14 @@ export default {
|
|||
userName
|
||||
} = storeToRefs(d2AdminUserStore)
|
||||
|
||||
const route = useRoute()
|
||||
const isCustomBody = computed(() => get(route.meta, 'd2admin.layout.dashboard.customBody', false))
|
||||
|
||||
return {
|
||||
classname,
|
||||
userAvatar,
|
||||
userName,
|
||||
isCustomBody,
|
||||
collapsed,
|
||||
collapseIcon,
|
||||
collapsedToggle
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<route>
|
||||
{
|
||||
meta: {
|
||||
title: 'dashboard'
|
||||
"meta": {
|
||||
"title": "dashboard"
|
||||
}
|
||||
}
|
||||
</route>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,19 @@
|
|||
<route>
|
||||
{
|
||||
"meta": {
|
||||
"d2admin.layout.dashboard.customBody": true
|
||||
}
|
||||
}
|
||||
</route>
|
||||
|
||||
<template>
|
||||
<demo-page-placeholder/>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
setup () {
|
||||
console.log(1)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<route>
|
||||
{
|
||||
meta: {
|
||||
title: '首页'
|
||||
"meta": {
|
||||
"title": "首页"
|
||||
}
|
||||
}
|
||||
</route>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<route>
|
||||
{
|
||||
meta: {
|
||||
title: '登录'
|
||||
"meta": {
|
||||
"title": "登录"
|
||||
}
|
||||
}
|
||||
</route>
|
||||
|
|
|
|||
Loading…
Reference in New Issue