刘力
3 years ago
10 changed files with 148 additions and 25 deletions
-
23src/layout/components/AppMain.vue
-
29src/layout/components/Item.vue
-
14src/layout/components/TopMenus.vue
-
2src/layout/components/index.js
-
1src/layout/index.js
-
68src/layout/index.vue
-
4src/router/index.js
-
28src/router/routers.js
-
2src/store/modules/user.js
-
2src/views/login.vue
@ -0,0 +1,23 @@ |
|||
<template> |
|||
<section class="app-main"> |
|||
<transition name="fade-transfrom" mode="out-in"> |
|||
<keep-alive :include="cachedViews"> |
|||
<router-view :key="key" /> |
|||
</keep-alive> |
|||
</transition> |
|||
</section> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: 'AppMain', |
|||
computed: { |
|||
cachedViews() { |
|||
return this.$store.state.tagsView.cachedViews |
|||
}, |
|||
key() { |
|||
return this.$route.path |
|||
} |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,29 @@ |
|||
<script> |
|||
export default { |
|||
name: 'MenuItem', |
|||
functional: true, |
|||
props: { |
|||
icon: { |
|||
type: String, |
|||
default: '' |
|||
}, |
|||
title: { |
|||
type: String, |
|||
default: '' |
|||
} |
|||
}, |
|||
render(h, context) { |
|||
const { icon, title } = context.props |
|||
const vnodes = [] |
|||
|
|||
if (icon) { |
|||
vnodes.push(<svg-icon icon-class={icon}/>) |
|||
} |
|||
|
|||
if (title) { |
|||
vnodes.push(<span slot='title'>{(title)}</span>) |
|||
} |
|||
return vnodes |
|||
} |
|||
} |
|||
</script> |
@ -0,0 +1,2 @@ |
|||
export { default as AppMain } from './AppMain' |
|||
export { default as TopMenus } from './TopMenus' |
@ -1 +0,0 @@ |
|||
export { default as TopMenus } from './TopMenus.vue' |
@ -0,0 +1,68 @@ |
|||
<template> |
|||
<div> |
|||
<top-menus /> |
|||
</div> |
|||
</template> |
|||
|
|||
<script> |
|||
import TopMenus from './components/TopMenus.vue' |
|||
import { mapState } from 'vuex' |
|||
export default { |
|||
name: 'Layout', |
|||
components: { TopMenus }, |
|||
computed: { |
|||
...mapState({ |
|||
TopMenus: state => state.app.sidebar |
|||
}), |
|||
classObj() { |
|||
return { |
|||
hideSidebar: !this.sidebar.opened |
|||
} |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
<style lang="scss" scoped> |
|||
@import "~@/assets/styles/mixin.scss"; |
|||
@import "~@/assets/styles/variables.scss"; |
|||
|
|||
.app-wrapper { |
|||
@include clearfix; |
|||
position: relative; |
|||
height: 100%; |
|||
width: 100%; |
|||
|
|||
&.mobile.openSidebar { |
|||
position: fixed; |
|||
top: 0; |
|||
} |
|||
} |
|||
|
|||
.drawer-bg { |
|||
background: #000; |
|||
opacity: 0.3; |
|||
width: 100%; |
|||
top: 0; |
|||
height: 100%; |
|||
position: absolute; |
|||
z-index: 999; |
|||
} |
|||
|
|||
.fixed-header { |
|||
position: fixed; |
|||
top: 0; |
|||
right: 0; |
|||
z-index: 9; |
|||
width: calc(100% - #{$sideBarWidth}); |
|||
transition: width 0.28s; |
|||
padding: 0; |
|||
} |
|||
|
|||
.hideSidebar .fixed-header { |
|||
width: calc(100% - 54px) |
|||
} |
|||
|
|||
.mobile .fixed-header { |
|||
width: 100%; |
|||
} |
|||
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue