Why can't routes in sub-pages of multiple pages be accessed properly by vue-cli3?

  1. for a multi-page project developed using vue-cli3, the configuration of pages is as follows:
pages: {
        index: {
            entry: "./resources/src/main.js",
            template: "./resources/public/index.html",
            filename: "index.html"
        },
        print: {
            entry: "./resources/src/print/main.js",
            template: "./resources/public/print.html",
            filename: "print.html"
        }
    }

routing configuration in index:

[
    {
        path: `${prefix}/createAccount`,
        name: "createAccount",
        component: createAccount
    }]

now access routes in index can be accessed normally by using localhost:8080/foreground/createAccount
routes in print are as follows:

[
    {
        path: `${prefix}/print`,
        name: "print",
        component: index,
        beforeEnter: (to, from, next) => {
            console.log("wer")
            next()
        }
    }
]

but you can access the page by visiting localhost:8080/print.html, but you cannot use localhost:8080/print/foreground_print/print to access print routing-sharp-sharp-sharp problem description

the environmental background of the problems and what methods you have tried

GitHub Code

Aug.09,2021

now the route in index can be accessed normally by using localhost:8080/foreground/createAccount

this is because the default redirect is to / index.html

but you can access the page by visiting localhost:8080/print.html, but you cannot use localhost:8080/print/foreground_print/print to access print routing

redirects to / index.html, the. / resources/src/main.js entry by default, but this entry does not contain a / print/foreground_print/print route.

there may be something wrong with the practice of multi-page applications. It is recommended to change the page of print to:

        print: {
            entry: './resources/src/print/main.js',
            template: './resources/public/print.html',
            filename: '/print/index.html'
        }

in this way, you can access the relevant pages through / print, and using hash routing in multi-page applications is a little more stable than history routing. I have done some configuration and summary before, hoping to provide you with some information. https://github.com/vv13/vue-cli-multipage


also encountered the same problem. How did you solve the problem


solved the article: https://codeshelper.com/a/11.

"
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e8e974-11f1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e8e974-11f1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?