在移动应用程序中的页面之间导航的最佳方法是什么 [英] What is the best approach for navigating between pages in a mobile application

查看:103
本文介绍了在移动应用程序中的页面之间导航的最佳方法是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在多页移动应用程序中更改页面的最佳方法是什么?

What is the best approach for changing pages in a multipage mobile application?

我已经看到它完成了两种方式(如下所示).我似乎无法理解哪种方法是最好的方法.两者之间有区别吗?

I have seen it done both ways (as shown below). I can't seem to understand which one is the best approach. Are there differences between the two?

$("#nextPage").load("myapp.html", function(){
  alert("loaded next page!");
});

对比..

$('#currentPage').hide();
$('#nextPage').show();

推荐答案

对于您在问题中所写内容的区别-请参阅@Japser的评论,但总的来说:

For the difference between what you've wrote in the question - see comment by @Japser, but in general:

我要说的是,它取决于您的应用程序设计,您要使用它的距离",以及您选择用于开发它的框架(Sencha,jQuery Mobile,jQuery,Dojo等),等等. ..

I would say it depends on your app design, on "how far" you want to take it, on the framework you choose for developing it with (Sencha, jQuery Mobile, jQuery, Dojo, ...), etc...

如果您变得简单",则可以将1个HTML文件视为您的主页,并在其中具有DIV,您将使用jQuery的.load将其内容替换为与其他HTML文件不同的内容...

If you "go simple", you can have 1 HTML file considered as your main page, and in it have a DIV which you will use jQuery's .load to replace its content with different content from other HTML files...

您还可以使用jQuery Mobile方法,再次使用.changePage等,具体取决于您实际想要做的事情.

You can also use the jQuery Mobile approach for the same, which uses .changePage, etc... again, depending on what you actually want to do.

最后,这取决于您要完成的工作.
没有最好的方法.

At the end, it depends on what you want to accomplish.
There is no one best approach.

并且,如果您曾经在基于Worklight的项目中实现多页导航,则切记Worklight应用程序是单页应用程序是非常重要的.您不得离开" Worklight上下文,否则您的应用程序将停止运行.在此处查看更多信息:

And if you ever implement multi-page navigation in a Worklight-based project, it is highly important to remember that a Worklight application is a Single Page Application. You must not "leave" the Worklight context, or else you application will stop functioning. See more here: IBM Worklight 6.1 - Why is Cordova code not working when placed in a sub-page?

这篇关于在移动应用程序中的页面之间导航的最佳方法是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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