Comments (13)
这事我早先还想着来着,每次想起都被其他事情淹没过去了。。。我的观点是:
确实有一个这样的attribute比较方便,也是必要的。不过我的建议是,用一个新的attribute,比如data-uicontrol
。
用新attribute的好处是:
- 保证
data-ui-xxx
的值一定是控件使用者写的。 - 这个是最重要的:
init
时可以判断当前元素是否已经创建了控件实例
from esui.
那么可以叫data-ui-ctrl
,值是id还是把type+id都写上?
from esui.
我个人不建议以data-ui-xxx开头。原因是match了uiAttribute的prefix
type的话,个人觉得没有写的必要,不过想写也行,{type}id
?id:type
?
from esui.
- data-uictrl
- data-control
- data-instance
- data-uicontrol
- data-uiinstance
上面是我瞎想的
from esui.
不用data-ui
开头的话,干脆就data-ctrl
得了呗,也不记得有啥知名的框架会用这种属性
from esui.
我也不记得。。。
要不,main的config里+一个instanceAttribute
,默认data-ctrl
好了~
from esui.
OK,这块就这么做吧,辛苦 @errorrik 写几行,那块不是很熟悉暂时不敢乱碰
from esui.
好哈
from esui.
由于有viewContext机制,data-ctrl并不能标识控件所属viewContext,所以依旧无法查询。这块灰大看看?
from esui.
现阶段还没有用到 从id反查控件 的地方,未来要有这样的需求,也由需求实现者自己管好ViewContext
,比如ef的UIView
来提供getControlFromDOM
这样的方法,所以并不冲突
from esui.
如刚才的讨论,发现还是有通过main元素反查控件
的场景的
from esui.
请 @otakustay review代码后,没问题再关闭。
from esui.
看完,没问题
from esui.
Related Issues (20)
- 日程投放控件 HOT 4
- InputCollection 应当继承 ControlCollection HOT 1
- Table 的 overflowX 属性为非 hidden 的时候多出一个横向滚动条 HOT 3
- BoxGroup有一处事件没使用addDOMEvent绑定
- 解决set和setProperties触发change的问题
- Table的依赖不全
- 控件初始化子控件时的valueReplacer管理
- 控件初始化子控件时的valueReplacer管理
- 控件初始化子控件时的valueReplacer管理
- 指定元素的销毁子控件
- Select 控件对于value比较判断的兼容性问题 HOT 2
- 希望能添加一些布局相关的组件 HOT 4
- 对于带有数据源的控件是否应该支持外部不提供数据源的场景的表决 HOT 19
- addChild的时候添加校验 HOT 6
- viewContext的疑问 HOT 3
- 加个Lisence HOT 1
- MonthView的年月下拉框格式可调 HOT 1
- 渐变背景的问题
- Panel控件的addContent方法不适用table布局 HOT 2
- 关于拓展组件
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esui.