JQM 1.4.1:新事件"pagecontainershow" [英] JQM 1.4.1: The new event 'pagecontainershow'

查看:92
本文介绍了JQM 1.4.1:新事件"pagecontainershow"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对JQM更改感到困惑:

I got confused with JQM changes:

您可能知道JQM已弃用该事件:

As you may know JQM deprecated the event:

$(document).on('pageshow', '#MyPage', function(){ 

并替换为:

$(document).on('pagecontainershow', function (e, ui) {

但是,此新事件未像以前那样附加到特定页面.尽管如此,该事件:

However this new event is not attached to an specific page as the previous was. Nevertheless, the event:

$(document).on('pagecreate', '#MyPage', function(){ 

仍附在特定页面上,我认为其他页面事件仍附在特定页面上.

is still attached to a specific page, and i think other pages events are still attached to specific pages.

我的问题是:

某些事件附加在页面上而另一些没有,这使该框架非常混乱.将所有事件都标准化,是不是更好,因为1.3版本将所有事件都附加到页面上?

The fact that some events are attached to pages and other no, makes the framework very confusing. Should'nt be better to standarized all events as the version 1.3 was in which all were attached to pages?

因为'pageshow'现在是1.4.1版,将来会把'pagecreate'事件和所有页面事件转移到页面上

Will the event 'pagecreate' and all pages events be dettached to pages in the future as 'pageshow' is now in version 1.4.1

有人可以解释一下1.4.1中的事件如何工作吗

Can someone please explain how events work in 1.4.1

谢谢

推荐答案

我刚刚解决了pagecontainershow无法通过使用"switch case"语句附加到PAGE的问题,如下所示:

I just resolved the issue of pagecontainershow not being able to attach to a PAGE by using a "switch case" sentence like this:

$(document).on('pagecontainershow', function (e, ui) {

var ThisPage = $(':mobile-pagecontainer').pagecontainer('getActivePage').attr('id');

  switch(ThisPage){

    case 'Page1':

    case 'Page2':

    case 'Page3':


etc....

但是,我担心的是,如果他们修改框架以(再次支持)附加到页面的事件,那么我应该进行重做和重做.

However my concern is that if they modify the framework to support (back again) the event attached to pages, then I should be doing rework and rework.

这篇关于JQM 1.4.1:新事件"pagecontainershow"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆