javascript – scrollBehavior not working properly in createRouter VUE JS v3

in vue documentation they say we can use like this :

scrollBehavior (to, from, savedPosition) {
      if (to.hash) {
        return {
          selector: to.hash,
          behavior: 'smooth',
        }
      }
    }

but this is not working at all.

what is the problem ?