Coder Social home page Coder Social logo

initialState参数配置 about dva HOT 8 CLOSED

dvajs avatar dvajs commented on May 14, 2024
initialState参数配置

from dva.

Comments (8)

sorrycc avatar sorrycc commented on May 14, 2024

动态创建 dva ? 具体场景是啥?


initialState 和 model.state 区别如下:

  • initialState 是初始值,通常来自服务器端给的数据,或者 localStorage 里取的数据
  • model.state 是初始化 model 时的默认值
  • 优先级上,initialState 大于 model.state

from dva.

carlos121493 avatar carlos121493 commented on May 14, 2024

嗯,就是initialState里的state可不可以只给部分?
还会报错。

dva已经更新到1.0.0-beta1 版了

from dva.

sorrycc avatar sorrycc commented on May 14, 2024

initialState 的数据给多了?

from dva.

sorrycc avatar sorrycc commented on May 14, 2024

印象中,给多了才会报错吧。过滤掉不需要的再传就好了。

from dva.

carlos121493 avatar carlos121493 commented on May 14, 2024

没多,发现initialState可以给少的,只是会全局将Modal中的state替换掉,然后还会报错。

from dva.

carlos121493 avatar carlos121493 commented on May 14, 2024

可能是我model里的state给的比initialState多?

from dva.

sorrycc avatar sorrycc commented on May 14, 2024

给个能重现的代码示例,我跑跑看。

from dva.

carlos121493 avatar carlos121493 commented on May 14, 2024

加了你的权限 http://@_@/ladybug/ladybug-core (已做保密处理..)

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.