Pictures path in question

A vue project has a picture package after it found that the background-image path there is a problem
solving method:
1, first import the data inside this picture, for example:
BG: The require ( './ openIndexBG2.jpg')
2, template which then need to be bound to the DOM background-image attributes, such as:
: style = "{the backgroundImage: 'URL (' + BG + ')'}"
This will avoid the path caused by the packed the problem

Reproduced in: https: //www.jianshu.com/p/98a9e2e62bb7

Guess you like

Origin blog.csdn.net/weixin_34293902/article/details/91190144