GithubHelp home page GithubHelp logo

dva 路由onEnter会进入多次 about dva HOT 6 CLOSED

dvajs avatar dvajs commented on May 14, 2024
dva 路由onEnter会进入多次

from dva.

Comments (6)

wangguohao avatar wangguohao commented on May 14, 2024

打算降级到0.0.6了,修改一下dva的render,就可以在路由中使用store了
router的function 跟 onEnter也不会进入多次
就是不能像1.0.0-beta1 一样写model了...

from dva.

sorrycc avatar sorrycc commented on May 14, 2024

看起来像是这里引入的问题,

match({ location, routes }, (error, _, renderProps) => {

from dva.

wangguohao avatar wangguohao commented on May 14, 2024

嗯,确实是这部分引起的
我用onEnter 跟 onLeave话,订阅history就不是很有必要了,我先注释了

感谢

from dva.

sorrycc avatar sorrycc commented on May 14, 2024

这段逻辑有些不妥,加的时候就担心会有副作用,我想想要不要去掉。

from dva.

sorrycc avatar sorrycc commented on May 14, 2024

match 的逻辑下个 beta 版里会去掉,然后 params 通过 path-to-regexp 获取,参考:dvajs/dva-hackernews@3314c7c

from dva.

sorrycc avatar sorrycc commented on May 14, 2024

bumped [email protected]

from dva.

Related Issues (20)

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.