Skip to content

Commit 5540411

Browse files
committed
feat: 自适应高度和路由默认跳转
1 parent bd2de8d commit 5540411

File tree

3 files changed

+21
-11
lines changed

3 files changed

+21
-11
lines changed

mock/sys/user.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function createFakeUserList() {
1111
desc: 'manager',
1212
password: '123456',
1313
token: 'fakeToken1',
14-
homePath: '/dashboard/analysis',
14+
homePath: '/charts/marsgis',
1515
roles: [
1616
{
1717
roleName: 'Super Admin',

src/marsgis/views/index.vue

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,22 @@
11
<template>
22
<KeepAlive>
3-
<div style="height: calc(100% - 10px)">
3+
<div :style="{ height: height + 'px' }">
44
<MainView />
55
</div>
66
</KeepAlive>
77
</template>
88
<script lang="ts" setup>
9-
import { ref } from "vue"
9+
import { ref, onMounted } from "vue"
1010
import MainView from "@mars/components/mars-work/main-view.vue"
11+
12+
const height = ref(600)
13+
14+
onMounted(() => {
15+
height.value = document.body.clientHeight - 80
16+
})
17+
18+
window.onresize = function () {
19+
height.value = document.body.clientHeight - 80
20+
}
1121
</script>
1222
<style lang="less"></style>

src/router/routes/modules/demo/charts.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@ const charts: AppRouteModule = {
1515
},
1616
children: [
1717
{
18-
path: 'baiduMap',
19-
name: 'BaiduMap',
18+
path: 'marsgis',
19+
name: 'Marsgis',
2020
meta: {
21-
title: t('routes.demo.charts.baiduMap'),
21+
title: '三维地图',
2222
},
23-
component: () => import('/@/views/demo/charts/map/Baidu.vue'),
23+
component: () => import('/@/marsgis/views/index.vue'),
2424
},
2525
{
26-
path: 'marsgis',
27-
name: 'Marsgis',
26+
path: 'baiduMap',
27+
name: 'BaiduMap',
2828
meta: {
29-
title: 'mars3d',
29+
title: t('routes.demo.charts.baiduMap'),
3030
},
31-
component: () => import('/@/marsgis/views/index.vue'),
31+
component: () => import('/@/views/demo/charts/map/Baidu.vue'),
3232
},
3333
{
3434
path: 'aMap',

0 commit comments

Comments
 (0)