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

img 动态src两个问题 #60

Open
Dowgen opened this issue Oct 7, 2017 · 4 comments
Open

img 动态src两个问题 #60

Dowgen opened this issue Oct 7, 2017 · 4 comments

Comments

@Dowgen
Copy link

Dowgen commented Oct 7, 2017

1.如果是 img :src="path"
这样的话,把需要的图片放同级目录下assets文件夹内,
data:{ path:'./assets/xxx.img'} 这样是引用不到的

2.我在根目录里添加static/img目录,把图片放这里面去,run dev倒是引用到了,但是run build之后dist/static/img里是不会有这些图片的,求解

@634323580
Copy link

@Dowgen 请问解决了吗

@Dowgen
Copy link
Author

Dowgen commented Oct 30, 2017

@634323580 这玩意儿搞了我好久,最后放弃动态src的写法,直接把可能会显示的图片dom全部写上,通过某data的值来区分当前应该显示哪张图片

@dongj0316
Copy link

dongj0316 commented Oct 30, 2017

这就是你自己的问题咯,如果你要:src="'/assets/xxx.jpg'"这样写,比如xxx.png放在src下的assets文体夹下,你要把xxx.png移到项目/static/assets文件夹下,:src=“‘/static/assets/xxx.png’” @Dowgen
因为build后,所有资源文件都是在static目录下

@webliyang
Copy link

用require

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