2020-08-13 11:47:56 +08:00
|
|
|
export default function scrollBehavior (to) {
|
2021-10-18 18:52:29 +08:00
|
|
|
if (to.hash) {
|
2020-08-13 11:47:56 +08:00
|
|
|
// scroll to anchor by returning the selector
|
2021-10-18 18:52:29 +08:00
|
|
|
return {
|
|
|
|
selector: decodeURIComponent(to.hash),
|
|
|
|
offset: {
|
2021-10-20 01:11:27 +08:00
|
|
|
y: 32
|
2021-10-18 18:52:29 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
x: 0,
|
|
|
|
y: 0
|
2020-08-13 11:47:56 +08:00
|
|
|
}
|
|
|
|
}
|