The scrollBehavior scrolling attribute in Vue-router does not support secondary routing? How can the configuration work?

scrollBehavior (to, from, savedPosition) {
  return { x: 0, y: 0 }
}

my goal is to scroll to the top of the page every time after switching routes
but this configuration only seems to work for first-level routes, but secondary route switching like / page/1-> / page/2 doesn"t work. What should I do with it


second-level routing is supported. This is what my code says.
router/index.js

const scrollBehavior = (to, from, savedPosition) => {
    if (savedPosition) {
        // savedPosition is only available for popstate navigations.
        return savedPosition;
    } else {
        const position = {}
            // new navigation.
            // scroll to anchor by returning the selector
        if (to.hash) {
            position.selector = to.hash
        }
        // check if any matched route config has meta that requires scrolling to top
        if (to.matched.some(m => m.meta.scrollToTop)) {
            // cords will be used if no selector is provided,
            // or if the selector didn't match any element.
            position.x = 0
            position.y = 0
        }
        // if the returned position is falsy or an empty object,
        // will retain current scroll position.
        return position;
    }
};

let router = new Router({
    mode: 'history',
    scrollBehavior,
    routes: [
        {
            path: '/detail/:id',
            name: 'Detail',
            component: Detail,
            meta: {
                scrollToTop: true
            }
        }
    ]
});
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3353b-34250.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3353b-34250.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?