Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

背景图片资源不打包 #62

Open
pzZZZZ opened this issue Oct 31, 2017 · 5 comments
Open

背景图片资源不打包 #62

pzZZZZ opened this issue Oct 31, 2017 · 5 comments

Comments

@pzZZZZ
Copy link

pzZZZZ commented Oct 31, 2017

不是img内的图片都不会自动打包么?

@pzZZZZ
Copy link
Author

pzZZZZ commented Nov 1, 2017

解决了
note: { backgroundImage: "url(" + require("./assets/headimg.png") + ")" }
这样引入就可以正常解析路径

@zuishuanglin
Copy link

zuishuanglin commented Nov 10, 2017

你这个图片是放在页面的asstes目录下的吗?但是我在css和style中使用背景图,打包后图片路径不对,求教!!!
刚才在页面中试了一下你的方法,是可行的,但是还又的问题是在css中require是不可能行的,那这个问题怎么解决呢,难道要全部放在页面上去吗

@EarlEcho
Copy link

@pzZZZZ 大神求教,这个怎么解决的,倒腾半天了。

@webliyang
Copy link

webliyang commented Nov 23, 2017

@EarlEcho
template的div中 :style="bgcstyle"
data中 bgcstyle:{}
mounted 函数中 this.bgcstyle = {'background-image': "url(" + require("./assets/bg.png") + ")"}

@webliyang
Copy link

webliyang commented Dec 4, 2017

在build/utils.js中加上publicPath
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants