ocordeiro / vue-smooth-scroll

Simple vue smooth scroll
77 stars 12 forks source link

problem with vue-router and history api #10

Closed ilhamwahabi closed 6 years ago

ilhamwahabi commented 6 years ago

lets say my current route is /dashboard if i'm did smooth scrolling (from one of my component) to other component that has id #content (below it) my route now is content

Now the problem is i want my route back again to '/dashboard' . I have trying history API and also with vue router. But it's look like this library keep 'force' us to stay in this route.

this.$router.replace('/dashboard')
this.$router.push('/dashboard') But the change that happen just content to /content

Same as if i did history.pushState({}, null, '/dashboard/') history.go(-1); history.back()

Not fatal and not give error, but just not good behavior. It's become problem when someone trying to reload the page after did smooth-scrolling. And it's weird for me when look the url bar and see mydomaincontent

I'm currently using vue-cli webpack. And just test it in my localhost.

!update, now when i'm change it to class, lets say .content-class it's show error page. !update, i'm trying to handle it by router. If path = 'content' will redirect to '/dashboard' but it's not worked. Even if that worked, too much effort if i'm using many smooth-scroll in my project.