Git Product home page Git Product logo

Comments (16)

errorrik avatar errorrik commented on July 22, 2024
  1. 我原先设想是,afterrender只触发一遍的,重渲染没事件触发。
  2. setXXX方法自己会重渲染(比如setText,它自己会main.innerHTML=xxx),set(name, value)方法逻辑应该是:如果有setXXX走它,没有的话直接设置属性,然后repaint
  3. 对于:想在控件上挂一点和控件本身没啥关系的数据, @wurongyao 提的data是解决方案。setData里不调用渲染咯

伪代码:

if (this.setPropName) { this.setPropName(value) }
else { this.propName = value; this.repaint(); }

from esui.

otakustay avatar otakustay commented on July 22, 2024
  1. 现在的实现好像是会触发的,所以这算实现上的问题,明天修之?但是要有repaint这种事件么,感觉是有使用的场景的,比如因为repaint()过程中可能会清掉子元素再重建,所以子元素上的事件会丢掉要重新注册?
  2. 现有的实现就是那段伪代码了。如果确认无关数据有setData提供,那就没问题了,确实没找到有set之后不用repaint的属性存在

from esui.

errorrik avatar errorrik commented on July 22, 2024
  1. 现在的实现不会触发的

        if (helper.isInited(control)) {
            control.fire('afterrender');
        }
    

from esui.

otakustay avatar otakustay commented on July 22, 2024

我去isInited原来是指 生命周期是否刚好在INITED阶段 而非 是否在INITED之后 ,这命名有点二义性啊……话说isInited这种方法存在的必要性……怕控件开发人员不知道那个枚举能用?

from esui.

errorrik avatar errorrik commented on July 22, 2024

话说isInited这种方法存在的必要性……怕控件开发人员不知道那个枚举能用?

因为require太多麻烦。我写太多次this.lifeCycle == require('Control').LifeCycle.INITED了

from esui.

otakustay avatar otakustay commented on July 22, 2024

在头里写个var LifeCycle = require('Control').LifeCycle嘛- -这属性一个文件中到处要用的变量,放在头里是合适的,或者那个isInited名字能再准确点

from esui.

errorrik avatar errorrik commented on July 22, 2024

在头里写个var LifeCycle = require('Control').LifeCycle嘛

具体控件这么写没问题。就是写helper的时候,Control依赖helper,helper再直接依赖control,那就死了。。。然后既然做了,就暴露出来给写控件用咯。名字或者你想个更好的?

from esui.

otakustay avatar otakustay commented on July 22, 2024

名字或者你想个更好的?

isInStage('INITED')

from esui.

errorrik avatar errorrik commented on July 22, 2024

果然有isIn。我当时就是看这两个i打头的单词放一起别扭。。。

from esui.

otakustay avatar otakustay commented on July 22, 2024

所以这个事情的最正确解决方案应该是把LifeCycle做成一个独立的枚举模块?

from esui.

errorrik avatar errorrik commented on July 22, 2024

所以这个事情的最正确解决方案应该是把LifeCycle做成一个独立的枚举模块?

我觉得算了,搞得太复杂。就isInStage吧。那control的lifeCycle属性得改成stage,要不又有理解障碍了。

from esui.

otakustay avatar otakustay commented on July 22, 2024

我倒觉得没有太大必要,属性和方法的命名是从2个角度去解释的。“我当前的生命周期在XX阶段”这是属性(属性天生有表达“当前”的意思),而“判断是否在XXX阶段”这是方法,叫isInLifeCycleStage显长

from esui.

errorrik avatar errorrik commented on July 22, 2024

就是“我当前的生命周期在XX阶段”。我觉得,lifecycle感觉是整个周期,stage更好表达了控件当前所属阶段这个意思

from esui.

otakustay avatar otakustay commented on July 22, 2024

没意见……只要现在这个时候整体改名字的代价能接受,不过好像也就你这边的事,其它控件开发者没用上这东西~

from esui.

errorrik avatar errorrik commented on July 22, 2024

我。。。

from esui.

otakustay avatar otakustay commented on July 22, 2024

这事已经结束了

from esui.

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.