I think it has been partially solved by https://github.com/vuejs/vue-router/issues/47 but I can't make it work with named routes
router.go('routename#withanchor') // works according to https://github.com/vuejs/vue-router/issues/47
router.go({name: 'routename'}) // how can I pass anchor ?
Anyone had this issue ?
router.go({name: 'routename', hash: 'anchor-here'})
Already tried it (i'm on latest release for vue 1 i.e. 0.7.13)
Also tried the following but there is no hash in the generated href
<a v-link="{name: 'routename', hash: 'anchor'}">link</a>
Sorry, I thought you were using vue-router 2.0...
Using hash isn't supported in 0.7, please consider migrating to 2.0: http://vuejs.org/guide/migration-vue-router.html
Migrating to 2.0 is too heavy does not worth for this kind of problem. Is there a way to get the path from route object instead of going to the page (I could use it and append manually the hash) ?
Something like:
router.getPath({name: 'routename'})
Unfortunately that's also only available in 2.0 as router.match() (undocumented though..)
I reproduced the behavior of the anchor with query parameter ?hash=anchor thanks for you help !
Most helpful comment
router.go({name: 'routename', hash: 'anchor-here'})