简体   繁体   English

拥有多页GWT应用程序的可行性

[英]Viability of having a multi-page GWT app

I know MVC and MVP for GWT application, my question would be not be about creating "multipage MVP app." 我知道GWT应用程序的MVC和MVP,我的问题不是关于创建“多页MVP应用程序”。

My question is about the viability of creating a GWT application with multiple pages (ie multiple HTML files) for the actual web app (app.html) and a admin app (admin.html) 我的问题是关于为实际的Web应用程序(app.html)和管理应用程序(admin.html)创建具有多个页面(即多个HTML文件)的GWT应用程序的可行性

In a typical GWT MVP app this can be done by just adding a "page" or "view" however this can make the nocache.js bloat and will just make the whole application load slow (based on experience) 在典型的GWT MVP应用程序中,可以通过添加“页面”或“视图”来完成此操作,但这会使nocache.js变得nocache.js并且只会使整个应用程序加载速度变慢(根据经验)

I saw this abandoned project: gwt-multipage which allows a GWT app to be multi-paged. 我看到了这个废弃的项目: gwt-multipage ,它允许对GWT应用进行多页处理。 However I want to know if this kind of approach will also just bloat the nocache.js file? 但是我想知道这种方法是否还会使nocache.js文件膨胀?

You seem to want a separate Admin module/app. 您似乎想要一个单独的管理模块/应用程序。 See this StackOverflow response for an architecture to accomplish. 请参阅此StackOverflow响应以了解要完成的体系结构。

I assume you know that you will lose all GWT state when you switch between those pages right? 我假设您知道在这些页面之间切换时会丢失所有GWT状态,对吗?

I don't have a chance to look at the gwt-multipage project right now but what you're asking for implies also having multiple entrypoints in your GWT app (one for the users page and one for the admin page). 我现在没有机会查看gwt-multipage项目,但是您要提供的内容意味着您的GWT应用程序中还包含多个入口点(一个用于用户页面,一个用于管理页面)。 Since each GWT module can only have one entrypoint, you'll need to create an additional module for the admin page. 由于每个GWT模块只能有一个入口点,因此您需要为管理页面创建一个附加模块。 I know this doesn't answer your question completely but if I was you I would look further in the direction of how to define different GWT modules. 我知道这并不能完全回答您的问题,但是如果您是我,我将进一步朝着如何定义不同的GWT模块的方向发展。

One way to solve your problem is to use code splitting . 解决您的问题的一种方法是使用代码拆分 It allows you to have a single host page without having to download all the code at startup. 它使您可以拥有一个主机页面,而不必在启动时下载所有代码。 You download additional code when it is needed. 您需要时下载其他代码。

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

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