Created
September 16, 2019 13:27
-
-
Save nobiit/a1128c0006b90d32806ad8587fff1c83 to your computer and use it in GitHub Desktop.
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(); | |
}, | |
watch: { | |
'$data.$menu'() { | |
this._updateMenu(); | |
} | |
}, | |
methods: { | |
_updateMenu: function () { | |
this.$emit('update-menu', this.$data.$menu); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment