perf[Sidebar]: set scrollbar respond to height changes

perf/sidebar
Pan 2019-03-08 15:07:09 +08:00
parent 1a6ae849df
commit 532cac465b
1 changed files with 10 additions and 1 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<el-scrollbar wrap-class="scrollbar-wrapper"> <el-scrollbar ref="scrollbar" wrap-class="scrollbar-wrapper">
<el-menu <el-menu
:show-timeout="200" :show-timeout="200"
:default-active="$route.path" :default-active="$route.path"
@ -8,6 +8,8 @@
:text-color="variables.menuText" :text-color="variables.menuText"
:active-text-color="variables.menuActiveText" :active-text-color="variables.menuActiveText"
mode="vertical" mode="vertical"
@close="change"
@open="change"
> >
<sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path"/> <sidebar-item v-for="route in routes" :key="route.path" :item="route" :base-path="route.path"/>
</el-menu> </el-menu>
@ -34,6 +36,13 @@ export default {
isCollapse() { isCollapse() {
return !this.sidebar.opened return !this.sidebar.opened
} }
},
methods: {
change() {
setTimeout(() => {
this.$refs.scrollbar.update()
}, 500) // update after animation
}
} }
} }
</script> </script>