[英]Sencha Touch not initializing
我的sencha touch应用程序在所有浏览器中运行良好,但是当我将URL保存到iPad主屏幕时。 它不会加载,只显示一个空白屏幕。 我没有得到JS错误,调试时没有任何内容通过日志。 下面是应用程序的示例:
script type="text/javascript">
var rootPanel;
if (navigator.userAgent.match(/iPad/i)) {
viewport = document.querySelector("meta[name=viewport]");
viewport.setAttribute('content', 'width=980');
}
Ext.application({
launch: function () {
var contactForm = Ext.create('Ext.form.FormPanel', {
standardSubmit: true,
fullscreen: true,
items: [{
xtype: 'titlebar',
title: 'My App',
docked: 'top'
}, {
xtype: 'fieldset',
items: [{
xtype: 'textfield',
name: 'LoginName',
label: 'Login Name:'
}, {
xtype: 'passwordfield',
name: 'Password',
label: 'Password:'
},
{
xtype: 'hiddenfield',
name: 'ReturnUrl',
value: '/returnUser.html'
}] // items
}, {
xtype: 'toolbar',
layout: {
pack: 'center'
}, // layout
ui: 'plain',
items: [{
xtype: 'button',
text: 'Reset',
ui: 'decline',
handler: function (btn, evt) {
Ext.Msg.confirm('', 'Are you sure you want to reset this form?', function (btn) {
if (btn === 'yes') {
contactForm.setValues({
LoginName: '',
Password: ''
}); // contactForm()
} // switch
}); // confirm()
}
}, {
xtype: 'button',
text: 'Submit',
ui: 'confirm',
handler: function (btn, evt) {
var values = contactForm.getValues();
contactForm.submit({
url: 'Login',
method: 'POST',
waitTitle: 'Connecting',
waitMsg: 'Sending data...',
success: function (form, result) {
Ext.Msg.alert('Login succeeded!', result.response.reason);
},
failure: function (form, result) {
Ext.Msg.alert('Login Failed!', result.response.reason);
}
});
} // handler
}] // items (toolbar)
}] // items (formpanel)
}); // create()
} // launch
}); // application()
$(document).ready(function () {
});
我在Ext.Application
的启动方法中Ext.Application
但它没有显示。 当我在document.ready
函数中发出警告时,它确实显示了。 我还要指出它在iPad上浏览器中运行,只是没有从主屏幕上的图标启动时。
我在android中面临类似的问题实际上在我的情况下问题是因为Ext.Loader未启用我看到你还没有包括它。 在Ext.application之前包含此脚本并查看它是否有效
Ext.Loader.setConfig({
enabled:true
});
Ext.application({...});
它似乎是我使用的sencha的版本2.1.0我相信,一旦我更新到最新(2.1.1 Build Date 2013-02-05 12:25:50)我工作正常。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.