App.vue
2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<template>
<div id="app">
<mu-drawer :open.sync="side_show" :docked="docked" :right="position === 'right'" :z-depth="1">
<mu-list>
<mu-list-item v-for="(v, k) in side_menu" :key="k" button>
<mu-list-item-title>{{ v.title }}</mu-list-item-title>
</mu-list-item>
<!-- <mu-list-item @click="close" button>
<mu-list-item-title>Close</mu-list-item-title>
</mu-list-item> -->
</mu-list>
</mu-drawer>
<mu-appbar :class="['mu-appbar-header', {'is-open': side_show}]" color="primary">
<mu-button v-if="!side_show" @click="side_show = !side_show" icon slot="left">
<mu-icon value="menu"></mu-icon>
</mu-button>
<p style="text-align: left;">Title</p>
<mu-button flat slot="right">LOGIN</mu-button>
</mu-appbar>
<!-- <mu-row gutter>
<mu-col span="4" sm="0" md="3" lg="2" xl="2">
<side :show="show2"></side>
123
</mu-col>
<mu-col span="8" sm="12" md="9" lg="10" xl="10">
<mu-appbar style="width: 100%;" color="primary">
<mu-button icon slot="left">
<mu-icon value="menu"></mu-icon>
</mu-button>
Title
<mu-button flat slot="right">LOGIN</mu-button>
</mu-appbar>
<p>111</p>
<router-view/>
</mu-col>
</mu-row> -->
<div style="left: 256px; top: 100px; position: relative; width: calc(100% - 256px)">
<router-view/>
</div>
</div>
</template>
<script>
// import side from 'components/side'
export default {
components: {
// side
},
mounted () {
// 屏幕宽度小于600隐藏侧边栏
if ($('body').width() <= 600) {
this.side_show = false;
this.docked = false;
} else {
this.side_show = true;
this.docked = true;
}
// 键盘屏幕宽度
$(window).resize(() => {
this.screen_width = $('body').width();
// 屏幕宽度小于600隐藏侧边栏
if (this.screen_width <= 600) {
this.side_show = false;
this.docked = false;
} else {
this.side_show = true;
this.docked = true;
}
});
},
data () {
return {
side_show: false,
screen_width: '',
docked: false,
position: 'left',
side_menu: [{
title: 'Menu Item 1'
}, {
title: 'Menu Item 2'
}]
}
},
methods: {
close () {
// 关闭侧边栏
this.side_show = false;
$(window).resize()
}
}
}
</script>
<style lang="less">
#app {
font-family: 'Avenir', Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
}
.mu-appbar-header {
position: fixed;
left: 0;
right: 0;
top: 0;
z-index: 101;
overflow: hidden
}
.mu-appbar-header.is-open {
left: 256px;
}
.mu-appbar-header.is-only-title .mu-appbar-title {
margin-left: 16px
}
</style>