我的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
的启动方法中发出警告但未显示。当我在它显示的document.ready
函数中发出警报时。我还应该注意到 DOES 在ipad浏览器上工作,而不是从主屏幕上的图标启动时。
答案 0 :(得分:1)
我在Android中遇到了类似的问题实际上在我的情况下问题是因为Ext.Loader未启用我看到你还没有包括它。在Ext.application&之前包含此脚本看看它是否有效
Ext.Loader.setConfig({
enabled:true
});
Ext.application({...});
答案 1 :(得分:0)
它似乎是我使用的sencha版本2.1.0我相信,只要我更新到最新版本(2.1.1 Build Date 2013-02-05 12:25:50)我工作正常