Git Product home page Git Product logo

Comments (4)

liuxingpluck avatar liuxingpluck commented on May 22, 2024

哦哦 不好意思,刚刚仔细 看了下你的官方文档:
https://concentjs.github.io/concent-doc/api/g-configure

有个 configure 函数,应该是能实现 这种功能的,那我 再提个建议咯,你看下修改:

https://concentjs.github.io/concent-doc/api/g-reducer
这个文档中的 reducer 函数,只说明 具体调用时 提供的参数,并没有 说明 主动调用时 参数的类型
比如:上一个 issue 你给我说的 : payload,{renderKey}

另外 像 : ccOption 这种 props 里面的参数,我搜索 api文档 也没看到

希望你有空 能补全下,我准备 开始 推广 公司里的小组使用了,这样他们看的时候,不会太糊涂

from helux.

fantasticsoul avatar fantasticsoul commented on May 22, 2024

非常感谢你的建议,文档的确还有很多很多需要改进的确地方,因为是个人维护,最近处于答辩关键时期,所以文档这一块的建设工作就比较慢了,欢迎你或者你的小伙伴加入concent qq群:647642619,有时候issue里反馈比较慢的话直接群里提问也可以,群里会有其他热心用户帮忙解答。

关于ccReducer的使用建议是在脱开实例的地方才使用,然后维护一个有类型的ccReducer暴露出来给全局用,这样非常方便ide补全方法调用(而非直接使用原始的 cc.reducer,这个只适合在console里直接调用):
参加js实例:https://codesandbox.io/s/concent-guide-xvcej?file=/src/components/biz-smart/Menu.js
ts实例:https://codesandbox.io/s/concent-guide-ts-zrxd5?file=/src/components/biz-smart/Menu.tsx

注: ccReducer 维护在 src/base/ccReducer下了

renderKey这些提示其实是因为你还未标注类型所以ide感知不到,例如
https://codesandbox.io/s/concent-guide-xvcej?file=/src/pages/FnVsClass/BetterFnDemo.js:1669-1672
这个文件的50那里,你刻意解开既可以便可查看renderKey等参数说明

强烈建议多看看示例工程的代码组织方式,通过 types/store集中维护好所有模块的类型,然后在整个项目的任意地方都可以使用这些类型了。

文档这方面肯定会努力完善,欢迎你或者其他小伙伴多多关注concent并点颗小星星,这是作为开源作者能收到的最大精神鼓励,也是持续维护和更新下去的动力。

最后我准备升级下版本,renderKey的注入方式可通过id来标识,当实例上有id属性时,则当前组件的renderKey就设置为id的值,这样可以让用户省去构造ccOption的麻烦,因为绝大多数场景实例的id通常就是唯一标识符号。

改进前:

<Cell key={id} ccOption={{renderKey:id}} id={id}/>

改进后:

<Cell key={id}  id={id}/>

// 组件的setup里取到的renderKey的值就是id

function setup(ctx){
   const { renderKey, props, ccUniqueKey } = ctx;
   // 如果设置了props里设置了id
   renderKey === props.id
   // 如果没有设置props.id
   renderKey ===  ccUniqueKey
}

from helux.

fantasticsoul avatar fantasticsoul commented on May 22, 2024

已优化,见示例:https://codesandbox.io/s/render-key-dwrx1?file=/src/App.js
id 即可作为renderKey标识

from helux.

fantasticsoul avatar fantasticsoul commented on May 22, 2024

我会尽量优先吧高频使用的api逐步补齐到足够友好的程度,感谢建议

from helux.

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.