Sencha Touch & ExtJS profiles for desktop and mobi

2019-04-02 01:55发布

I'm creating a web application with desktop and mobile versions using ExtJS and Sencha Touch.

ExtJS 4 and Sencha Touch 2 use an MVC approach, and Sencha Touch 2 incorporates "profiles" for different devices (iPhone, tablet, etc.).

ExtJs 4, however, has no notion of profiles. Is it realistically feasible to for dependencies for desktop, iPhone, and iPad versions of the app to live under one vhost, in the same app directory hierarchy?

Or, is it generally more acceptable to use different vhosts for desktop (app.com) and mobile sites (m.app.com) when dealing with the Sencha frameworks?

2条回答
萌系小妹纸
2楼-- · 2019-04-02 02:42

Right now, no it's not realistic to have everything in the same project.

Ext JS and Touch, despite having similar APIs, do not have the same API. Therefore you likely cannot share any code between the frameworks (currently Ext JS 4.1.3 and Touch 2.1.0 are the latest releases).

Therefore, since you're ultimately writing separate apps, I'd keep them totally separate code bases.

As for your domain/vhost question... you could configure your server either way, I don't know if that matters so much in my opinion.

查看更多
The star\"
3楼-- · 2019-04-02 02:51

I recently had the same situation. I have a single c# controller that returns the desktop or mobile index.html based on useragent. It all appears as http://www.mydomain.tld and runs under a single IIS site. Since all the calls are AJAX to REST, they share the same server code. It's only the view that changes. The same could be done with any other server and language.

My structure is:

Root
 |_desktop
 |   |_app
 |   |_lib
 |   |_resources
 |_mobile
 |   |_app
 |   |_lib
 |   |_resources
 |_shared
     |_localization.js (generic JS objects)
     |_proto.js (my generic prototype functions)
查看更多
登录 后发表回答