【发布时间】:2021-11-09 00:53:30
【问题描述】:
我正在尝试使用 Vue.js 和 Spring boot 创建应用程序。使用 Vue 路由切换到不同的路由后,我的页面会重新加载。我正在使用这段代码转发到我的客户端路由。
@Controller
class FrontController {
@GetMapping("/**/{path:[^\\.]*}")
fun redirect(@PathVariable path: String): String {
return "forward:/index.html"
}
}
index.js
const routes = [
{
path: '/sad',
name: 'AdminDashboard',
component: AdminDashboard
},
{
path: '/',
name: 'UserList',
component: UserList
},
{
path: '/role/all',
name: 'RoleList',
component: RoleList
},
{
path: '/course/all',
name: 'CourseList',
component: CourseList
},
{
path: '/category/all',
name: 'CategoryList',
component: CategoryList
}
]
const router = new VueRouter({
mode: 'history',
routes
})
export default router
这是显示我的问题的 gif:https://imgur.com/zv0CIzv。因此,我试图在打开不同页面时摆脱闪烁。它在 Microsoft Edge 上运行良好,但在 Chrome 和 Firefox 上运行良好。
【问题讨论】:
-
请edit 描述您提出的问题或遇到的问题的标题。您当前的标题只不过是标签信息的重复。如果你删除了反刍的标签信息,你的整个标题就是 SPA。您的标题应该足够清晰和具有描述性,以便对正在浏览搜索结果列表并试图找到问题解决方案的未来网站用户有意义。谢谢。
-
请澄清您的具体问题或提供其他详细信息以准确突出您的需求。正如目前所写的那样,很难准确地说出你在问什么。
标签: spring-boot vue.js kotlin