The foreground project built by vue is packaged and put into the Spring Boot background. The page cannot be accessed directly, and can only be accessed through the home menu.

the foreground project built by vue is packaged and put into the Spring Boot background. But can not directly access the page, can only click through the home menu to enter the jump. (before packing, the front desk can visit the page directly through the url address, and the above situation occurs directly after packaging.
do you have a boss who knows what"s going on?
Direct access:

clipboard.png

:

clipboard.png

foreground routing settings:
const routes = [

{
    path: "/",
    component: () => import("@/views/Main.vue"),
    name: "",
    children: [{
        path: "",
        component: () => import("@/views/dashboard/Dashboard.vue"),
        meta: [],
    }]
},{
    path: "/404",
    component: () => import("@/views/error/404.vue"),
    name:"404"
}, {
    path: "/reportUpload",
    component: () => import("@/views/report/ReportUpload.vue"),
    meta: ["", ""]
}, {
    path: "/reportDownload",
    component: () => import("@/views/report/ReportDownload.vue"),
    meta: ["", ""]
}, {
    path: "/dataSource",
    component: () => import("@/views/datasource/DataSource.vue"),
    meta: ["", ""]
}, {
    path: "/ReprotData",
    component: () => import("@/views/report/ReprotData.vue"),
    meta: ["", ""]
}, {
    path: "/dictManager",
    component: () => import("@/views/report/dict-manage/DictManager.vue"),
    meta: ["", ""]
}, {
    path: "/reportManage",
    component: () => import("@/views/report/ReportManager.vue"),
    meta: ["", ""]
}, {
    path: "/reportStep",
    component: () => import("@/views/report/ReportStep.vue"),
    meta: ["", ""]
}, {
    path: "/dictSQLManager",
    component: () => import("@/views/report/dict-manage/DictSQLManager.vue"),
    meta: ["", "SQL"]
}

]


because your direct access to / datasource sends a request to the server, but the server does not have this file or controller to handle this path, so it returns 404.
Why do you access / can? because there is an index.html in the root directory that is the entrance to vue, so you may want to ask why I can access it through the Home menu. Obviously it is normal
this is because the route of vue manipulates the url, in the address bar to change the address bar via javascript, and does not send a request to the server. How can
be accessed directly by / datasource? The
solution is to forward all requests from this application to the following article
on index.html. I'll talk about it in more detail and give a configuration method for apache. You can refer to
https://www.zhihu.com/questio.


solved
https://www.jianshu.com/p/96c.

.
Menu