好的,我正在测试封装在 Phonegap 中的 Sencha Touch 框架,并使用 Android 2.2 编译为 HTC Desire。这个应用程序的目的只是为了熟悉框架和它的(in)功能。
我正在使用 MVC 模型。该应用程序包含一个项目列表,这些项目使用代理从 json 文件加载到数据存储中。单击其中一项时,将显示详细信息页面。
app.views.viewport.setActiveItem(app.views.placesList, options.animation);
但在过渡之前,存在某种滞后,白屏显示的时间非常短。为了更清楚,我做了一个视频:
http://www.youtube.com/watch?v=uW8hspMKqfc
下面的代码显示了我的应用程序的结构和功能:
模型
app.models.Place = Ext.regModel("app.models.Place", {
fields: [
{name: "name", type: "string"},
{name: "location", type: "string"}
]
});
app.stores.places = new Ext.data.Store({
model: "app.models.Place",
proxy: {
type: 'ajax',
url : 'js/app/data/products.json',
reader: {
type: 'json',
root: 'products'
}
}
});
看法
app.views.PlacesList = Ext.extend(Ext.Panel, {
fullscreen: true,
scroll: 'vertical',
dockedItems: [{
xtype: 'toolbar',
title: 'PlacesList'
}],
items: [{
xtype: 'list',
store: app.stores.places,
itemTpl: '{name}',
onItemDisclosure: function () {
Ext.dispatch({
controller: app.controllers.places,
action: 'show'
});
}
}],
initComponent: function() {
app.stores.places.load();
app.views.PlacesList.superclass.initComponent.apply(this, arguments);
}
});
控制器
app.controllers.places = new Ext.Controller({
show: function(options) {
app.views.viewport.setActiveItem(app.views.placeDetail, options.animation);
},
back: function(options) {
app.views.viewport.setActiveItem(app.views.placesList, options.animation);
}
});
我想知道经验延迟是否只是 Sencha Touch 附带的东西,还是来自代码。
提前致谢,
杰拉德