@3liv/rijs.components 中文文档教程
Ripple | Components
当任何依赖项发生变化(组件定义、数据或样式)时,重绘页面上的任何自定义元素。
在您的页面上给出以下标记:
<component-name data="something">
使用 component-name
(函数)和 something
(数据)在 Ripple 中注册,它将调用 component-name.call (
每当在这些资源中的任何一个中检测到更改时。 在内部,这基本上是按如下方式实现的,但采用更通用的形式:
ripple('something').on('change', function(){
all('[data=something]')
.map(ripple.draw)
})
自定义元素的所有实例都将自动升级。 您还可以手动调用渲染:
ripple.draw(<el> | resource object | resource name)
如果第一个参数是 DOM 元素,它将重新渲染该元素。 如果它是资源(名称或对象),它将重新呈现页面上依赖于该资源的任何内容。
有关详细信息,请参阅 Primer#Components
Ripple | Components
Redraws any custom elements on the page when any of it's dependencies change (either the component definition, data, or styles).
Given the following markup on your page:
<component-name data="something">
With a component-name
(function) and something
(data) registered in Ripple, it will invoke component-name.call(<el>, something)
whenever a change is detected in either of those resources. Internally, this is basically implemented as follows but in a more generic form:
ripple('something').on('change', function(){
all('[data=something]')
.map(ripple.draw)
})
All instances of Custom Elements will be upgraded automatically. You can also manually invoke renders:
ripple.draw(<el> | resource object | resource name)
If the first parameter is a DOM element, it will rerender that. If it is a resource (name or object), it will rerender anything on your page that depends on that resource.
See the Primer#Components for more info