You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							36 lines
						
					
					
						
							1.5 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							36 lines
						
					
					
						
							1.5 KiB
						
					
					
				| = 应用入口 (War 包场景) | |
| 
 | |
| == 核心原理 | |
| 
 | |
| image::system-design/application-entry/001.png[,100%] | |
| 
 | |
| <1> 应用入口 URL | |
| <2> 用户登录页面 | |
| <3> 后端处理, 返回视图。 通过查看 io.sc.platform.mvc 模块的源码,在 resources/template 目录中没有 io.sc.platform.mvc.frontend.html 模版文件,该模版文件通过以下步骤生成 | |
| <4> io.sc.platform.mvc.frontend 是前端模块, public/index.html 文件就是首页模版文件 | |
| <5> 构建前端,构建后的前端文件位于 dist/public/io.sc.platform.mvc.frontend 目录中 | |
| <6> 将前端模块打包成 jar时, 将前端模块中的 dist/public/io.sc.platform.mvc.frontend/index.html 文件复制成 resources/template/io.sc.platform.mvc.frontend.html 文件 | |
| 
 | |
| == index.html 解析 | |
| 
 | |
| image::system-design/application-entry/002.png[,100%] | |
| 
 | |
| 该 index.html 文件需要加载 configure.js 文件,该文件包含前端运行时的最核心配置信息,主要包括: | |
| 
 | |
| . webContextPath: 应用上下文路径 | |
| . apiContextPaths: 默认后端 API 请求的服务地址前缀 | |
| 
 | |
| [source,javascript] | |
| ---- | |
| <script src="/configure.js" th:src="@{/configure.js}"></script> | |
| ---- | |
| 
 | |
| [TIP] | |
| <script> 的写法, 既包含 src 属性也包含 th:src 属性。 | |
| 在纯前端发布模式下: src 属性生效, th:src 属性被忽略; | |
| 在 war 发布模式下: th:src 生效且覆盖 src 属性 | |
| 
 | |
| 在 war 包情景下, 加载 /configure.js 文件,该文件如何获得? | |
| 
 | |
| image::system-design/application-entry/003.png[,100%] | |
| 
 | |
| 
 |