【发布时间】:2015-01-27 16:55:03
【问题描述】:
我正在使用 jQM 开发一个 Web 应用程序。这是一个单页应用程序,包含许多脚本生成的虚拟页面。我使用了很多对话框,偶尔关闭这些对话框会使我的应用返回起始页(历史记录中的 3 页)。
我无法制作测试用例,因为它只发生在复杂的案例中,基于数据库,并且只在 idevice 上,而不是在计算机上。
我发现了很多类似的问题,但都是针对 jQM 1.2 或更早版本的问题。我正在使用 jQM 1.5.3。
我在脚本中添加了log-page-event.js 工具,它给了我这个:
首先,页面加载“visite_client-86871”
[Log] pagebeforeshow (1422376478507) (log-page-events.js, line 44)
page: div.visite_client.ui-page.ui-page-theme-a.ui-page-header-fixed.ui-page-footer-fixed#visite_client-86871
data-url: visite_client-86871
[Log] hashchange (1422376481313) (log-page-events.js, line 44)
location: http://m2.biocrm.fr/#visite_client-86871
[Log] pagehide (1422376482645) (log-page-events.js, line 44)
page: div.ui-page.ui-page-theme-a#edit_visite
data-url: edit_visite
[Log] pageshow (1422376483145) (log-page-events.js, line 44)
page: div.visite_client.ui-page.ui-page-theme-a.ui-page-header-fixed.ui-page-footer-fixed.ui-page-active#visite_client-86871
data-url: visite_client-86871
[Log] pagechange (1422376483171) (log-page-events.js, line 44)
page: div.visite_client.ui-page.ui-page-theme-a.ui-page-header-fixed.ui-page-footer-fixed.ui-page-active#visite_client-86871
data-url: visite_client-86871
然后,我点击打开对话框:
[Log] popstate (1422376499968) (log-page-events.js, line 44)
location: http://m2.biocrm.fr/#visite_client-86871&ui-state=dialog
state.hash:
[Log] hashchange (1422376501192) (log-page-events.js, line 44)
location: http://m2.biocrm.fr/#visite_client-86871&ui-state=dialog
然后,我关闭对话框:
[Log] popstate (1422376521377) (log-page-events.js, line 44)
location: http://m2.biocrm.fr/#visite_client-86871
state.hash: #visite_client-86871
[Log] hashchange (1422376521403) (log-page-events.js, line 44)
location: http://m2.biocrm.fr/#visite_client-86871
又无缘无故回到首页“tournees”
[Log] pagebeforechange (1422376521407) (log-page-events.js, line 44)
page: div.ui-page.ui-page-theme-a.ui-page-footer-fixed#tournees
data-url: tournees
[Log] pagebeforechange (1422376521459) (log-page-events.js, line 44)
page: div.ui-page.ui-page-theme-a.ui-page-footer-fixed#tournees
data-url: tournees
[Log] pagebeforehide (1422376521501) (log-page-events.js, line 44)
page: div.visite_client.ui-page.ui-page-theme-a.ui-page-header-fixed.ui-page-footer-fixed.ui-page-active#visite_client-86871
data-url: visite_client-86871
我可以做些什么来检测错误的原因,或者防止它发生? 看起来 jQM 对他的历史感到困惑。是否可以更精确地记录它?
非常感谢。
【问题讨论】:
标签: jquery jquery-mobile dialog