问题描述
我正在尝试使用JQuery Mobile和EmberJS构建一个小型移动应用程序。
这实际上是一个罗得斯应用程序(Rhomobile)。
I am trying to build a small mobile app with JQuery Mobile and EmberJS.This is actually a Rhodes Application (Rhomobile).
这是我的Layout.erb:
This is my Layout.erb:
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Todo</title>
<!-- Ember Libraries -->
<script src="/public/js/libs/handlebars-1.0.0.js"></script>
<script src="/public/js/libs/ember.js"></script>
<script src="/public/js/libs/ember-data.js"></script>
<!-- Ember Application -->
<script src="/public/js/application.js"></script>
<script src="/public/js/router.js"></script>
<script src="/public/js/models/todo.js"></script>
<script src="/public/js/controllers/todos_controller.js"></script>
<script type="text/javascript">
$(document).bind("mobileinit", function(){
$.mobile.loadingMessage = false;
$.mobile.loadingMessageDelay = 300; // in ms
$.mobile.defaultPageTransition = 'none';
$.mobile.defaultDialogTransition = 'none';
$.mobile.ajaxEnabled = false;
$.mobile.pushStateEnabled = false;
$.mobile.loadingMessageDelay = 50; // in ms
});
</script>
<link rel="stylesheet" href="/public/jqmobile/jquery.mobile-1.3.1.min.css">
<link rel="stylesheet" href="/public/css/jqmobile-patch.css">
<script src="/public/jqmobile/jquery.mobile-1.3.1.min.js"></script>
<script src="/public/js/jqmobile-patch.js"></script>
</head>
<body data-platform="<%= Rho::System.getProperty('platform') %>">
<%= @content %>
</body>
</html>
正如你所看到的,我已经禁用了Ajax和PushState和东西。这是我的index.erb:
As you can see I have disabled Ajax and PushState and stuff. This is my index.erb:
<script type="text/x-handlebars" data-template-name="todos">
<div data-role="page">
//My Template
</div>
</script>
现在,当我尝试它,我只是一个空白的灰色页面。但在控制台或Ember-Console(Chrome扩展)中没有错误。它甚至可以正确地检测到我的视图和控制器。
Now when I try it, I just get a blank grey page. But no error in console or in Ember-Console (extension of Chrome). It even detects my views and controllers properly.
然后我尝试评论JqueryMobile CSS文件,我得到的是一个页面的高度值为空白的加载消息和然后我看到我的应用程序在下面,它的工作正常。如果我删除JqueryMobile JS,我得到的东西,但它没有风格。
Then I try commenting the JqueryMobile CSS files and what I get is a page's height worth of blank space with "Loading" message and then I see my application below and it works fine. And if I remove JqueryMobile JS, I get the stuff but its not styled.
有什么问题?
推荐答案
没有看到你的应用程序的更多代码,这很难说。如果您只定义了一个模板('todos'
),可能Ember不知道如何启动应用程序的渲染。您可能需要定义一个'应用程序'
模板。这可能很简单:
It's kind of hard to say without seeing some more code of your app. If you only have the one template defined ('todos'
) it may be the case that Ember doesn't know how to kickstart the rendering of your app. You may need to define an 'application'
template. It might be as simple as:
<script type="text/x-handlebars" data-template-name="application">
{{outlet}}
</script>
这篇关于EmberJS和Jquery Mobile提供空白的灰色页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!