Skip to content

Commit 9067560

Browse files
committed
fix: display problem in mobile mode
1 parent 2ddf9e9 commit 9067560

File tree

6 files changed

+330
-317
lines changed

6 files changed

+330
-317
lines changed

src/App.vue

Lines changed: 43 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
<template>
2-
<a-locale-provider :locale="locale">
3-
<div id="app">
4-
<router-view/>
5-
</div>
6-
</a-locale-provider>
7-
</template>
8-
<script>
9-
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
10-
import enquireScreen from '@/utils/device'
11-
12-
export default {
13-
data () {
14-
return {
15-
locale: zhCN,
16-
}
17-
},
18-
created () {
19-
let that = this
20-
enquireScreen(deviceType => {
21-
// tablet
22-
if (deviceType === 0) {
23-
that.$store.commit('TOGGLE_DEVICE', 'tablet')
24-
that.$store.commit('CLOSE_SIDEBAR', false)
25-
}
26-
// mobile
27-
else if (deviceType === 1) {
28-
that.$store.commit('TOGGLE_DEVICE', 'mobile')
29-
that.$store.commit('CLOSE_SIDEBAR', false)
30-
}
31-
else {
32-
that.$store.commit('TOGGLE_DEVICE', 'desktop')
33-
that.$store.commit('SET_SIDEBAR_TYPE', true)
34-
}
35-
36-
})
37-
}
38-
}
39-
</script>
40-
<style>
41-
#app {
42-
height: 100%;
43-
}
1+
<template>
2+
<a-locale-provider :locale="locale">
3+
<div id="app">
4+
<router-view/>
5+
</div>
6+
</a-locale-provider>
7+
</template>
8+
<script>
9+
import zhCN from 'ant-design-vue/lib/locale-provider/zh_CN'
10+
import enquireScreen from '@/utils/device'
11+
12+
export default {
13+
data () {
14+
return {
15+
locale: zhCN,
16+
}
17+
},
18+
created () {
19+
let that = this
20+
enquireScreen(deviceType => {
21+
// tablet
22+
if (deviceType === 0) {
23+
that.$store.commit('TOGGLE_DEVICE', 'tablet')
24+
that.$store.dispatch('setSidebar', false)
25+
}
26+
// mobile
27+
else if (deviceType === 1) {
28+
that.$store.commit('TOGGLE_DEVICE', 'mobile')
29+
that.$store.dispatch('setSidebar', false)
30+
}
31+
else {
32+
that.$store.commit('TOGGLE_DEVICE', 'desktop')
33+
that.$store.dispatch('setSidebar', true)
34+
}
35+
36+
})
37+
}
38+
}
39+
</script>
40+
<style>
41+
#app {
42+
height: 100%;
43+
}
4444
</style>

src/components/page/GlobalLayout.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,12 @@
102102
device: state => state.app.device,
103103
})
104104
},
105+
watch: {
106+
sidebarOpened(val) {
107+
console.log('watch',val)
108+
this.collapsed = !val
109+
},
110+
},
105111
created() {
106112
this.menus = this.mainMenu.find((item) => item.path === '/').children
107113
},
@@ -144,10 +150,17 @@
144150
}
145151
}
146152
153+
/**
154+
* ant-table-wrapper
155+
* 覆盖的表格手机模式样式,如果想修改在手机上表格最低宽度,可以在这里改动
156+
*/
147157
.ant-table-wrapper {
148-
.ant-table-body {
158+
.ant-table-content {
149159
overflow-y: auto;
150160
}
161+
.ant-table-body {
162+
min-width: 800px;
163+
}
151164
}
152165
.sidemenu {
153166
.ant-header-fixedHeader {

src/config/router.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export const asyncRouterMap = [
1313
{
1414
path: '/dashboard',
1515
name: 'dashboard',
16-
redirect: '/dashboard/analysis',
16+
redirect: '/dashboard/workplace',
1717
component: RouteView,
1818
meta: { title: '仪表盘', icon: 'dashboard', permission: [ 'dashboard' ] },
1919
children: [

0 commit comments

Comments
 (0)