GithubHelp home page GithubHelp logo

Comments (7)

luventa avatar luventa commented on June 8, 2024

Hi @ProfFan
Issue fixed in nprogress #6 .
Need code review by @fundon

But you still need to check current path before redirecting to avoid vue-router issue.

      beforeEnter: (to, from, next) => {
        if (from.path === '/components') {
          next()
        } else {
          next('/components')
        }
      }

from nprogress.

ProfFan avatar ProfFan commented on June 8, 2024

Great, thanks :)

from nprogress.

ProfFan avatar ProfFan commented on June 8, 2024

P.S. @luventa Test case:

beforeEnter: (to, from, next) => {
        if (from.path === '/components') {
          next(false)
        } else {
          next('/components')
        }
      }

And the bar does not stop if I navigate to the guarded page when I was in '/components'.

from nprogress.

luventa avatar luventa commented on June 8, 2024

@ProfFan Yes, in that case router stops to call afterEach function. so the progress bar wont stop.
If you really need to abort the current navigation, we will need to provide the functionality for stopping progress bar manually.

from nprogress.

ProfFan avatar ProfFan commented on June 8, 2024

Maybe we should make a abort() function?

from nprogress.

xuzhy avatar xuzhy commented on June 8, 2024

What about using decorators?
Write a decorator function to wrap the push/replace method which is in the VueRouter class, and then inject the nprogress start/end logic around the target.

from nprogress.

luventa avatar luventa commented on June 8, 2024

@xuzhy Yes, that will be an approach.
And actually, in previous version, vue-bulma/nprogress exported a function called 'done' to stop itself.

from nprogress.

Related Issues (18)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.