|
|
@ -112,8 +112,9 @@ export function createRouter(loadComponent, fallbackComponent) {
|
|
|
|
* @param {*} e
|
|
|
|
* @param {*} e
|
|
|
|
*/
|
|
|
|
*/
|
|
|
|
(e) => {
|
|
|
|
(e) => {
|
|
|
|
if (e.target.tagName === 'A') {
|
|
|
|
const link = e.target.closest('a')
|
|
|
|
const { href, target } = e.target
|
|
|
|
if (link) {
|
|
|
|
|
|
|
|
const { href, target } = link
|
|
|
|
const targetUrl = new URL(href)
|
|
|
|
const targetUrl = new URL(href)
|
|
|
|
const currentUrl = window.location
|
|
|
|
const currentUrl = window.location
|
|
|
|
if (
|
|
|
|
if (
|
|
|
@ -127,7 +128,7 @@ export function createRouter(loadComponent, fallbackComponent) {
|
|
|
|
e.preventDefault()
|
|
|
|
e.preventDefault()
|
|
|
|
window.scrollTo({
|
|
|
|
window.scrollTo({
|
|
|
|
left: 0,
|
|
|
|
left: 0,
|
|
|
|
top: e.target.offsetTop,
|
|
|
|
top: link.offsetTop,
|
|
|
|
behavior: 'smooth'
|
|
|
|
behavior: 'smooth'
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|