Vue-router Showing Blank Page When Built
Solution 1:
You're using history mode for your router, which means you'll access your pages with paths like /login or /dashboard or /dashboard/personnel/professeurs, which are the only routes you declared.
/ or /index.html does not display anything because the router doesn't know what they are.
However, in order to have history mode working, you cannot just have a static server. The server has to know that a request to /dashboard should return the index.html file.
If you used VueCLI, the docs here might be helpful:
If you are using Vue Router in
historymode, a simple static file server will fail. For example, if you used Vue Router with a route for/todos/42, the dev server has been configured to respond tolocalhost:3000/todos/42properly, but a simple static server serving a production build will respond with a404instead.To fix that, you will need to configure your production server to fallback to
index.htmlfor any requests that do not match a static file. The Vue Router docs provides configuration instructions for common server setups.
If you don't want to deal with this, or don't have a server enabling you to do this, you can switch history to hash mode in your router. Your routes will be accessible at /index.html#/dashboard and so on.
Post a Comment for "Vue-router Showing Blank Page When Built"