vue-router 如何使用 hash push({name:"question"})?

How can vue-router push({name:"question"}) with hash?

例如:更改后的路线是https://whosebug.com/question#hello

router.push(位置,onComplete?,onAbort?) localtion

中需要名称

Vue Router 允许您完全自定义路由导航的滚动行为。 Vue 滚动行为是一个广泛的话题,因此您可以深入研究 docs

对于您的示例,我认为您需要具有滚动行为的散列属性:

Router.push({ name: routeName, hash: '#toHash' })

router.push({ name: 'question', hash: '#hello' }) 可以工作