1. 程式人生 > >vue-cli run build 後 背景圖片 css background:url('path') 載入問題

vue-cli run build 後 背景圖片 css background:url('path') 載入問題

1、在webpack.prod.conf.js檔案裡output裡面新增:publicPath:'./'

2、在utils.js檔案裡新增 publicPath:'../../'

3、在config/index.js檔案裡,新增assetsPublicPath:'./'

run build 之後 圖片 正常顯示 
成功!