yui2 和 yui3 事件

发布于 2024-09-18 16:06:31 字数 78 浏览 3 评论 0原文

yui3 的 Y.on() 构造是否可以用于为 yui2 小部件上的事件设置侦听器,或者它们只是使用单独的事件系统?

Can the yui3 construct of Y.on() be used to setup listeners for events on yui2 widgets, or do they simply use separate event systems?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

感性 2024-09-25 16:06:31

他们使用单独的事件系统。但是,您可以使用 Y.on() 设置 DOM 侦听器来触发 YUI 2 Widget 上的方法。

Y.on('focus', Y.bind(myCalendar.show, myCalendar), '#birthdate');

但更一般地说,

Y.on('click', function () {
    /* do other stuff... */

    myDataSource.sendRequest('filter=active', {
        success: myDataTable.onDataReturnInitializeTable,
        scope: myDataTable
    });

    /* ...and more stuff */
}, '#date-filter');

Y.on() 不能用于订阅 YUI 2 中的小部件自定义事件。

Y.on('activeTabChange', thisWontWork, myTabView); // does nothing

They use separate event systems. However, you can use Y.on() to set up DOM listeners that trigger methods on YUI 2 Widgets.

Y.on('focus', Y.bind(myCalendar.show, myCalendar), '#birthdate');

or more generically

Y.on('click', function () {
    /* do other stuff... */

    myDataSource.sendRequest('filter=active', {
        success: myDataTable.onDataReturnInitializeTable,
        scope: myDataTable
    });

    /* ...and more stuff */
}, '#date-filter');

Y.on() can't be used to subscribe to widget custom events in YUI 2, though.

Y.on('activeTabChange', thisWontWork, myTabView); // does nothing
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文