我是 Ext JS 的新手。我正在创建本教程中介绍的第一个应用程序:http://www.sencha.com/learn/getting-started-with-ext-js-4正如其中提到的,我创建了包含以下内容的 index.html:
<html>
<head>
<title>Hello Ext</title>
<link rel="stylesheet" type="text/css" href="extjs/resources/css/ext-all.css">
<script type="text/javascript" src="extjs/ext-debug.js"></script>
<script type="text/javascript" src="app.js"></script>
</head>
<body></body>
</html>
和带有以下代码的 app.js:
<a href="#!/api/Ext-method-application" rel="Ext-method-application" class="docClass">Ext.application</a>({
name: 'HelloExt',
launch: function() {
<a href="#!/api/Ext-method-create" rel="Ext-method-create" class="docClass">Ext.create</a>('<a href="#!/api/Ext.container.Viewport" rel="Ext.container.Viewport" class="docClass">Ext.container.Viewport</a>', {
layout: 'fit',
items: [
{
title: 'Hello Ext',
html : 'Hello! Welcome to Ext JS.'
}
]
});
}
});
但它显示空白页。如果我使用 Chrome 开发人员工具对其进行调试,它会显示此错误:Uncaught SyntaxError: Unexpected token < in app.js:1
我已经很努力了,但不知道 app.js 出了什么问题
我确定我的框架已正确设置并正常工作,但页面在加载时是空白的。
谢谢。
最佳答案
使用真正的 Javascript 而不是他们错误复制/粘贴的 html 包装的 javascript 文本,你可能会有更好的运气:
Ext.application({
name: 'HelloExt',
launch: function() {
Ext.create('Ext.container.Viewport', {
layout: 'fit',
items: [
{
title: 'Hello Ext',
html : 'Hello! Welcome to Ext JS.'
}
]
});
}
});
关于javascript - Ext JS 应用程序显示空白页,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8607178/