We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
It would be nice to be able to use hash with named route pattern.
hash
In vue-router 0.7.11, in History/html5 mode:
v-link="/page#section"
/page
v-link="{name: 'page', params: {}}"
anchor
v-link
v-link="{name: 'page', hash: 'section'}"
hash()
data
Vue.component('hash-hook-example', { // ... other options route: { hash (value) { console.log(`hash-hook triggered with ${value}`) } } })
If the hook is present, it is called. If not, the default behavior (aka. scroll to getElementById(hash)) is executed
getElementById(hash)
The text was updated successfully, but these errors were encountered:
+1 on this, would really like to see links that are create by Vue and can scroll to an anchor
Sorry, something went wrong.
@noirbizarre @divmgl Scrolling to hash is implemented in 2.0, as in scrollBehavior (release notes),
As for hash hook, since all transition hooks are deprecated in 2.0, there won't be any new hooks added, so you can just use a watcher on $route.
No branches or pull requests
It would be nice to be able to use
hash
with named route pattern.Currently
In vue-router 0.7.11, in History/html5 mode:
(ie.
v-link="/page#section"
will to to the route/page
and scroll to the element with this id (https://github.com/vuejs/vue-router/blob/master/src/index.js#L543-L560)v-link="{name: 'page', params: {}}"
)Proposal
hash
oranchor
inv-link
named route pattern handling (ie.v-link="{name: 'page', hash: 'section'}"
)hash()
transition hook called afterdata
hook, if hash value change (same behavior asdata
hook for hash) :If the hook is present, it is called. If not, the default behavior (aka. scroll to
getElementById(hash)
) is executedThe text was updated successfully, but these errors were encountered: