mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
fix(@vant/cli): doc preview page cannot scroll to the correct anchor (#7745)
Co-authored-by: caoenze <caoenze@didichuxing.com>
This commit is contained in:
parent
7a2a9eb36d
commit
2ff10d3c5e
@ -109,7 +109,7 @@ export const router = createRouter({
|
|||||||
routes: getRoutes(),
|
routes: getRoutes(),
|
||||||
scrollBehavior(to) {
|
scrollBehavior(to) {
|
||||||
if (to.hash) {
|
if (to.hash) {
|
||||||
return { selector: to.hash };
|
return { el: to.hash };
|
||||||
}
|
}
|
||||||
|
|
||||||
return { x: 0, y: 0 };
|
return { x: 0, y: 0 };
|
||||||
|
@ -30,9 +30,7 @@ export default {
|
|||||||
if (event.target.id) {
|
if (event.target.id) {
|
||||||
this.$router.push({
|
this.$router.push({
|
||||||
name: this.$route.name,
|
name: this.$route.name,
|
||||||
query: {
|
hash: '#' + event.target.id
|
||||||
anchor: event.target.id
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user