Coder Social home page Coder Social logo

请问像 业务组件 需要依赖 账户组件 中的状态和数据,这种组件依赖的情况是如何解决的的 about appjoint HOT 4 CLOSED

prototypez avatar prototypez commented on June 4, 2024
请问像 业务组件 需要依赖 账户组件 中的状态和数据,这种组件依赖的情况是如何解决的的

from appjoint.

Comments (4)

PrototypeZ avatar PrototypeZ commented on June 4, 2024

您好,账户组件提供接口,通过方法向其它组件暴露自身的状态和数据(getter)

from appjoint.

LandChanning avatar LandChanning commented on June 4, 2024

我的意思是,账户组件只有手动登录后才能获取用户数据,而业务组件想要依赖登录的页面和用户数据,是不是必须要将 账户组件 和 业务组件 同时编译,因为只调用账户组件暴露状态和方法并不能真正获取到数据啊(因为根本没进行登录操作)。

如果同时编译,那怎么实现呢?是在 业务组件 的独立 app 依赖中添加上 账户组件 吗?

from appjoint.

PrototypeZ avatar PrototypeZ commented on June 4, 2024

你好,我明白了,你的意思是,业务组件独立编译开发过程中如何获得账户组件的数据对吗?我这边的经验是,每个组件开发时都是独立编译的,所以不是你说的 “同时编译” 两个组件,至于业务组件需要依赖用户组件那边的数据,只要接口设计的巧妙,业务组件可以使用 Mock 出来的用户数据,至于 Mock 数据的方法,您可以参考我在 README 中链接的文章。如果我们发现业务组件独立编译开发时,引用的账户组件 Mock 数据很困难时,那说明我们的组件设计得过于耦合,我也经历过类似的情况,经过对账户组件和剩余业务组件解耦之后,开发起来就很顺利了

from appjoint.

LandChanning avatar LandChanning commented on June 4, 2024

好的,我再研究下,谢谢

from appjoint.

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.