vue打包后图片资源background引入路径加载失败

1 url前加上‘~@’ background: url(~@/../static/images/me/img.png) no-repeat;

2 build/utils.js加上publicPath:'../../',

if (options.extract) {

return ExtractTextPlugin.extract({

use: loaders,

publicPath:'../../',

fallback: 'vue-style-loader'

})

} else {

return ['vue-style-loader'].concat(loaders)

}

}

猜你喜欢

转载自blog.csdn.net/lucasxt/article/details/82219929