Created
September 16, 2019 16:18
-
-
Save nobiit/2587ca6fb62757d4cac476066cf9e42a to your computer and use it in GitHub Desktop.
Version 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<el-container class="app-container"> | |
<app-sidebar/> | |
<el-container direction="vertical"> | |
<app-header :menu="menu"/> | |
<el-main> | |
<transition | |
name="bounce" | |
enter-active-class="bounceInLeft" | |
leave-active-class="bounceOutRight" | |
> | |
<router-view @update-menu="onUpdateMenu"/> | |
</transition> | |
</el-main> | |
</el-container> | |
</el-container> | |
</template> | |
<style lang="scss" scoped> | |
@import '~bourbon'; | |
.app-container { | |
@include size(100%); | |
} | |
</style> | |
<script> | |
import AppSidebar from "./AppSidebar"; | |
import AppHeader from "./AppHeader"; | |
export default { | |
components: {AppSidebar, AppHeader}, | |
data() { | |
return { | |
menu: {} | |
} | |
}, | |
methods: { | |
async onUpdateMenu(menu) { | |
this.menu = menu; | |
} | |
}, | |
}; | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default { | |
created: function () { | |
this._updateMenu(); | |
this._updateMenuSelect(); | |
}, | |
watch: { | |
'$data.$menu'() { | |
this._updateMenu(); | |
}, | |
'$data.$menuSelect'() { | |
this._updateMenuSelect(); | |
} | |
}, | |
methods: { | |
_updateMenu: function () { | |
this.$emit('update-menu', this.$data.$menu); | |
}, | |
_updateMenuSelect: function () { | |
this.$emit('update-menu-select', this.$data.$menuSelect); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment