Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ViewContext id的进一步问题 #46

Closed
otakustay opened this issue May 11, 2013 · 7 comments
Closed

ViewContext id的进一步问题 #46

otakustay opened this issue May 11, 2013 · 7 comments
Labels

Comments

@otakustay
Copy link
Member

  1. 通过setViewContext更换时,是否要确保main上的data-ctrl-view-context属性同步变化?
  2. 我们是否让viewContext是只读的,以避免这一类问题的出现?想不到需要改变viewContext的情况。如果是只读的,我考虑删掉setViewContext方法。

@errorrik

@errorrik
Copy link

我觉得需要确保。看起来用户貌似没有显式修改的需求,但是可能会这样

var myButton = new Button();
xxCtrl.addChild( myButton );

如果xxCtrl不是在默认viewContext下,myButton的viewContext是需要被更改的。

@otakustay
Copy link
Member Author

那么我建议把data-ctrl-iddata-ctrl-view-context的配置丢到Control上去实现,而不在main中搞这事,只要是控件,其主元素就一定有这2个东西

@otakustay
Copy link
Member Author

补充一下,如果放在Control上实现,我们需要考虑是否允许setProperties({ viewContext: xxx })这样的写法,如果允许的话,我们还得把viewContext的修改放在repaint上实现,当然实现就一两行代码,不过所有的控件要记得调Control.prototype.repaint

@errorrik
Copy link

那么我建议把data-ctrl-id和data-ctrl-view-context的配置丢到Control上去实现,而不在main中搞这事,只要是控件,其主元素就一定有这2个东西

配置放main上是为了统一配置项的存放地,万一esui默认使用的data-xxxxxxx与用户已经用了的有冲突,可以在一个地方统一配置

@errorrik
Copy link

我们需要考虑是否允许setProperties({ viewContext: xxx })这样的写法

我没想到什么场景需要这样用,但是,从一致性上来讲,貌似需要支持

@otakustay
Copy link
Member Author

那么我去开工啦- -

@otakustay
Copy link
Member Author

53637ca 中支持, @errorrik 做下review没问题关吧?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants