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

控件初始化子控件时的valueReplacer管理 #585

Open
otakustay opened this issue Jun 12, 2016 · 0 comments
Open

控件初始化子控件时的valueReplacer管理 #585

otakustay opened this issue Jun 12, 2016 · 0 comments

Comments

@otakustay
Copy link
Member

控件在使用initChildren初始化子控件时,应该使用一个特殊的valueReplacer以便于将自己的属性分发到子控件中去,类似ef提供的Model和控件的关系

假设一个控件内部写了这样的模板:

<!-- for: ${list} as ${item}, ${index} -->
    <esui-custom-item data-ui-datasource="@list.${index}"></esui-custom-item>
<!-- /for -->

则应该会使得这个子控件的datasource属性指向父控件的list属性中的某一项

考虑到原来的initChildren的向后兼容性,为了实现这一功能,会增加一个initConnectedChildren方法,区别在于:

  • initChildren用于类似Panel的容器,其生成的子控件本身不由父控件控制,数据源使用的是再上层的
  • intiConnectedChildren用于有自己指定的子控件结构的控件,子控件完全由父控件管理,将父控件作为数据源
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant