jQuery Mobile changePage() 在 Windows Phone 中不起作用 [英] jQuery Mobile changePage() not working in Windows Phone

查看:26
本文介绍了jQuery Mobile changePage() 在 Windows Phone 中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Phonegap for Windows Phone 8 开发应用程序.

I am developing an application using Phonegap for Windows Phone 8.

我使用 jQuery Mobile 进行界面设计.

I've used jQuery Mobile for interface design.

$.mobile.changePage() 不起作用.页面没有被更改.

the $.mobile.changePage() is not working. The page is not being changed.

有没有其他方法可以更改页面?有没有其他框架可以设计移动界面?

Is there any other way to change the page? Is there any other framework to design the interface for mobile?

$("#btnSearch").bind('click', function() {
    showSpinner();
    $.mobile.changePage("#pageSearch");
});

推荐答案

我觉得这个问题和 WP7 描述的一样 这里.

I think this problem is the same as in WP7 described here.

检查路径问题:

if($.mobile.path.getLocation("x-wmapp1:/app/www/index.html") != "x-wmapp1:/app/www/index.html")
{
    console.log('there is path problem');
}
else
{
    console.log('everything is OK with paths');
}

解决方案:

如 github 中所述,问题是 WP7 上的路径与其他平台不同.基本上在 WP7 getLocation 打印带有双斜杠的相对路径,这首先会导致这个问题.要修复,请打开 jquery.mobile-1.3.1.js 并重构以下内容:

As described in github, problem is path on WP7 differs from other platforms. Basically on WP7 getLocation prints relative paths with double slashes, which causes this issue at first place. To fix, open jquery.mobile-1.3.1.js and refactor following:

-        var uri = url ? this.parseUrl( url ) : location,
-          hash = this.parseUrl( url || location.href ).hash;
+        var uri = this.parseUrl( url || location.href ),
+          hash = uri.hash;

和:

-        return uri.protocol + "//" + uri.host + uri.pathname + uri.search + hash;
+        return uri.protocol + uri.doubleSlash + uri.host + uri.pathname + uri.search + hash;

进行此更改后,检查应显示一切正常".

After making this changes, check should display "everything is OK".

PS 这是在 WP7 上测试的,完全解决了我的问题 $.mobile.changePage().

PS This is tested on WP7 and totally fixed my issue with $.mobile.changePage().

PS2 这个问题在 jQuery 的 github 版本中得到修复,虽然我刚刚检查了最新的稳定版本(1.3.2),不幸的是它没有在那里修复.

PS2 This issue is fixed at github version of jQuery, although I've just checked latest stable version(1.3.2) and unfortunately it is NOT fixed there.

问候,

赫里斯托·托多罗夫

这篇关于jQuery Mobile changePage() 在 Windows Phone 中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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