Vue package static resource path is incorrect solution
When the vue project is packaged and launched, it will encounter the problem that static resources cannot be found. There are two common ones.
1, js, css path is wrong
Solution: Open config/index.js and change the assetsPublicPath value in it to './'
2. The image resources referenced in css cannot be found
There is a css in my login.vue file that references a background image, which is written like this
.login{height:100%;background: url("../assets/login_bg.jpg") no-repeat; background-size: cover;color: white;}
There is this picture in the "src/assets/" folder. After packaging, the path changes and the picture cannot be found.
Open "build/utils.js" and add a line of code
Reprinted from: https://www.cnblogs.com/diantao/p/7776523.html
When the vue project is packaged and launched, it will encounter the problem that static resources cannot be found. There are two common ones.
1, js, css path is wrong
Solution: Open config/index.js and change the assetsPublicPath value in it to './'
2. The image resources referenced in css cannot be found
There is a css in my login.vue file that references a background image, which is written like this
.login{height:100%;background: url("../assets/login_bg.jpg") no-repeat; background-size: cover;color: white;}
There is this picture in the "src/assets/" folder. After packaging, the path changes and the picture cannot be found.
Open "build/utils.js" and add a line of code
Reprinted from: https://www.cnblogs.com/diantao/p/7776523.html