简体   繁体   English

如何将Sencha Touch 2.0合并到现有网页中?

[英]How do I incorporate Sencha Touch 2.0 into an existing webpage?

Basically, I want to combine a HTML5/CSS3 webpage with the Sencha Touch framework (to make use of it's awesome model/store/AJAX functionality). 基本上,我想将HTML5 / CSS3网页与Sencha Touch框架结合起来(以利用其出色的模型/存储/ AJAX功能)。

What would be the best way of doing this? 最好的方法是什么? At the moment I'm thinking of creating a top level container in Sencha and plugging the HTML for the page in as a template. 目前,我正在考虑在Sencha中创建一个顶级容器,并将页面的HTML作为模板插入。 However I'm going to need a few DataView objects and I'm not sure how I'd position them in the page unless the whole design was done using Sencha objects. 但是,我将需要一些DataView对象,并且不确定如何在页面中放置它们,除非整个设计是使用Sencha对象完成的。

Well you've got it pretty much figured out already, you just need to get your feet wet now. 嗯,您已经弄清楚了,现在只需要弄湿您的脚即可。 ST will let you embed any existing HTML or CSS in pretty much any component. ST将使您几乎将任何现有的HTML或CSS嵌入到任何组件中。 That will let you start to leverage ST's non-visual tools like stores and models. 这将使您开始利用ST的非可视工具(如商店和模型)。

The minute you want to start including other ST visual components though, you can get stuck. 但是,在开始包含其他ST视觉组件的那一刻,您可能会陷入困境。 ST components are intrinsically tied to it's layout system. ST组件本质上与其布局系统相关。 That means if you want to drop in lists or other data views, their size, alignment etc is all tied to their parents' layout and other attributes. 这意味着,如果您要放入列表或其他数据视图,则它们的大小,对齐方式等都取决于其父级的布局和其他属性。 If they're just dropped in freeform HTML they probably won't look right. 如果只是将它们放入自由格式的HTML中,则它们可能看起来不正确。

My advice is that you bite the bullet and re-do the whole site in ST. 我的建议是您硬着头皮在ST中重新做整个站点。 Remember that you can still re-use a lot of your existing HTML fragments within ST panels and containers of your new mobile site. 请记住,您仍然可以在新移动网站的ST面板和容器中重用许多现有的HTML片段。 But the important thing is that ST now forms the 'shell' of your mobile site, and that ensures that any ST components you use will be correctly formatted. 但是重要的是,ST现在构成了移动网站的“外壳”,并确保您使用的所有ST组件都将正确格式化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM