Compare commits

...

2 Commits

Author SHA1 Message Date
Bunny c0882ada7c 💄 调整UI页面平展开 2025-07-10 17:13:16 +08:00
Bunny 1afb95c602 🔧 添加跨域配置 2025-07-10 17:12:57 +08:00
4 changed files with 22 additions and 3 deletions

View File

@ -0,0 +1,19 @@
package cn.bunny.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@Configuration
public class CorsConfig implements WebMvcConfigurer {
@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**") // 所有接口
.allowedOrigins("*") // 允许所有来源
.allowedMethods("GET", "POST", "PUT", "DELETE", "OPTIONS") // 允许方法
.allowedHeaders("*") // 允许所有头
// .allowCredentials(true) // 允许凭证
.maxAge(3600); // 预检请求缓存时间
}
}

View File

@ -5,7 +5,7 @@ import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class WebController {
@GetMapping("/")
public String indexPage() {
return "redirect:/database";

View File

@ -28,7 +28,7 @@
<body>
<div id="app">
<div class="container my-4">
<div class="container-fluid my-4">
<!-- 主标题 -->
<app-header></app-header>

View File

@ -28,7 +28,7 @@
<body>
<div id="app">
<div class="container my-4">
<div class="container-fluid my-4">
<!-- 主标题 -->
<app-header></app-header>