forked from AkkomaGang/admin-fe
Implement scroll to settings submenu when it is opened
This commit is contained in:
parent
51de129b54
commit
07bc03f2ef
2 changed files with 10 additions and 1 deletions
|
@ -12,7 +12,7 @@
|
||||||
</el-menu-item>
|
</el-menu-item>
|
||||||
</app-link>
|
</app-link>
|
||||||
</template>
|
</template>
|
||||||
<el-submenu v-else ref="subMenu" :index="resolvePath(item.path)">
|
<el-submenu v-else ref="subMenu" :index="resolvePath(item.path)" :id="item.meta.title">
|
||||||
<template slot="title">
|
<template slot="title">
|
||||||
<item
|
<item
|
||||||
v-if="item.meta"
|
v-if="item.meta"
|
||||||
|
|
|
@ -71,6 +71,15 @@ export default {
|
||||||
const routes = this.getMergedRoutes()
|
const routes = this.getMergedRoutes()
|
||||||
this.$store.dispatch('GenerateRoutes', { roles: this.roles, _routesWithSettings: routes })
|
this.$store.dispatch('GenerateRoutes', { roles: this.roles, _routesWithSettings: routes })
|
||||||
}
|
}
|
||||||
|
let isRequesting = true
|
||||||
|
const step = () => {
|
||||||
|
document.querySelector('#settings').scrollIntoView({ block: 'start', behavior: 'smooth' })
|
||||||
|
if (isRequesting) requestAnimationFrame(step)
|
||||||
|
}
|
||||||
|
requestAnimationFrame(step)
|
||||||
|
setTimeout(() => {
|
||||||
|
isRequesting = false
|
||||||
|
}, 300) // this equals to the hide-timeout of the el-submenu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue