[英]chrome dojo mobile view
UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.75 Safari/537.36 UserAgent:Mozilla / 5.0(Windows NT 10.0; Win64; x64)AppleWebKit / 537.36(KHTML,例如Gecko)Chrome / 62.0.3202.75 Safari / 537.36
Steps to reproduce the problem: 1. View the attached HTML in Chrome 62.0.3202.75 2. Notice blank page 3. Right click, View Source 4. Notice properly rendered page 重现此问题的步骤:1.在Chrome 62.0.3202.75中查看附加的HTML 2.注意空白页3.右键单击,查看源代码4.注意正确渲染的页面
What is the expected behavior? 预期的行为是什么? The page should show a very simple dojo application
该页面应显示一个非常简单的dojo应用程序
What went wrong? 什么地方出了错? Previous versions of Chrome properly displayed the page.
早期版本的Chrome可以正确显示该页面。 The 62.0.3202 version will not.
62.0.3202版本不会。
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8" />
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="pragma" content="no-cache">
<title>Show Source to render page</title>
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.12.2/dojox/mobile/deviceTheme.js" data-dojo-config="mblUserAgent: 'WindowsPhone'"></script>
<!-- dojo configuration options -->
<script type="text/javascript">
dojoConfig = {
// Enable the AMD loader
async: true
};
</script>
<script src="https://ajax.googleapis.com/ajax/libs/dojo/1.12.2/dojo/dojo.js"></script>
<script>
require([
"dojox/mobile/parser",
"dojo/domReady!",
"dojox/mobile/View",
"dojox/mobile/Heading"
], function (parser) {
parser.parse();
});
</script>
</head>
<body style="visibility:hidden;">
<div id="newAccount" data-dojo-type="dojox/mobile/View">
<h1 data-dojo-type="dojox/mobile/Heading" data-dojo-props="back:'Login', moveTo:'logIn'">Register </h1>
New Account Stuff
</div>
<div id="logIn" data-dojo-type="dojox/mobile/View" data-dojo-props="selected:true">
<h1 data-dojo-type="dojox/mobile/Heading" data-dojo-props="back:'Register', moveTo:'newAccount'">Log In</h1>
Log in stuff
</div>
</body>
</html>
The dojo parser gets fired to early. dojo解析器被提前解雇。 The parser should wait until the DOM is loaded.
解析器应等待DOM加载完毕。 I think your hitting some timing issue in the code.
我认为您在代码中遇到了一些计时问题。 But if you use this code it will work:
但是,如果使用此代码,它将起作用:
require([
"dojox/mobile/parser",
"dojo/ready",
"dojox/mobile/View",
"dojox/mobile/Heading"
], function (parser,ready) {
ready(function(){
parser.parse();
})
});
I use the dojo/ready function here to wait until the page is build in browser. 我在这里使用dojo / ready函数,直到在浏览器中构建页面为止。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.