Skip to content

Can scrollBehaviour support to specify scroll container? #3481

New issue

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

Closed
kamilic opened this issue Mar 4, 2021 · 2 comments
Closed

Can scrollBehaviour support to specify scroll container? #3481

kamilic opened this issue Mar 4, 2021 · 2 comments

Comments

@kamilic
Copy link

kamilic commented Mar 4, 2021

What problem does this feature solve?

Our vue app uses a fixed height <div> as frame container to load all pages inside, like following snippet:

<div style="
     height: 100%; 
     width: 100%;
     position: fixed;
     overflow-x: hidden;
     overflow-y: scroll;
">
     <vue-router />
</div>

I wanted to use scrollBehaviour to handle page navigation's scrollTop, but it did't work.
And also I found that vue-router set scrollTop by using window. scrollTo method at here.

So I have this idea. For example, provides a scrollBehaviourContainer: "#id" to make it works?

What does the proposed API look like?

new VueRouter({
     scrollBehaviour(to, from, position) {
         return position;
     },
     scrollBehaviourContainer: "#el"
});
@posva
Copy link
Member

posva commented Mar 4, 2021

Duplicate of #1187

Right now you can still manually call scroll inside scrollBehavior and return nothing

@posva posva closed this as completed Mar 4, 2021
@kamilic
Copy link
Author

kamilic commented Mar 5, 2021

Duplicate of #1187

Right now you can still manually call scroll inside scrollBehavior and return nothing

got it, thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants