require图片

let menuPath =  "assets/img/menu.png";

//重新拼接 require(`@/${图片变量路径}`)
<img
  class="menu"
  :src="require(`@/${menuPath}`)"
/>

需要加require

设置backgroundImage

<img :src="require('assets/img/button.png')">
<div :style="{backgroundImage:'url('+require('assets/img/book.png')+')'}">
</div>
data() {
	return {
		img: 'url(' + require('../../assets/img/video.png') + ')'
	}
}
Logo

前往低代码交流专区

更多推荐