After vue project packaged home of black and white issue

Vue local project to browse the server side is no problem, but after performing npm run build local preview is packaged in black and white.

Solution

1. Path Problem

Found in the config folder index.js open to assetsPublicPath: '/' into assetsPublicPath: './'

2. Routing

router.js in comments

// the MODE: 'History', // default hash

src inside router / index.js routing configuration inside the default mode is hash, if it is history mode, open a blank page will appear. So hash mode to mode or directly delete the configuration mode and let it default on the line. If you have to use history mode, then you need a candidate resources to cover all the cases in the server plus: If the URL match any static resources, it should return a index.html, this is your app page relies page.

 

Guess you like

Origin www.cnblogs.com/lwming/p/10936531.html