如何使用 evently 将事件处理程序附加到 CouchApp 中的胡子渲染?
使用 evently / Mustache 编写 CouchApp 应用程序。我有几个“小部件”,其中一个有一个触发事件的链接,另一个设置为监听该事件。到目前为止,一切都很好。监听小部件有一个 data.js 文件,它返回一个关联数组; Mustache.html 使用 data.js 返回的值来填充模板。
我的 data.js 类似于
function( data ){
return {
name : 'people'
}
}
,mustache.html 是
<span id="fadeMe">Hello {{name}}</span>
<a href="#test">Click</a>
一切都很好。我知道如何通过创建 click.js 文件并将其放入选择器/a[href=#test]/click.js 中来向链接的单击事件添加处理程序
但我也想将 #fadeMe 范围设置为动画一旦它被渲染。是否存在“小胡子已呈现”事件? (从随 CouchApp 分发的文件来看似乎并不像)。我该如何实现这一目标?
提前致谢。
Writing a CouchApp app using evently / mustache. I have a couple of 'widgets', one has a link which triggers an event, and another is set up to listen to it. So far so good. The listening widget has a data.js file which returns an associative array; and mustache.html which uses the values return by data.js to fill in the template.
My data.js is something like
function( data ){
return {
name : 'people'
}
}
and the mustache.html is
<span id="fadeMe">Hello {{name}}</span>
<a href="#test">Click</a>
All that is good. I know how to add an handler to the click event of the link, by creating a click.js file and putting it in selectors/a[href=#test]/click.js
But I also want to animate the #fadeMe span as soon as it's rendered. Is there a 'mustache-has-rendered-it' event? (doesn't look like judging from the files distributed with CouchApp). How do I achieve this?
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以将 Javascript 函数放入
after.js
中。这将在小胡子和选择器之后调用。您可以在源代码中进行验证。更新:请注意,Evently 不再随 python couchapp 工具一起提供。
You can put a Javascript function in
after.js
. This will be called after mustache and selectors. You can verify it in the sources.UPDATE: note that Evently is not shipped with python couchapp tool anymore.