动态img src 需要用require
2021-11-23 本文已影响0人
流泪手心_521
1.动态的:src
<img
v-if="defaultTemplateType.includes(form.templateBaseCode)"
:src="require('@/assets/images/custom' + form.templateBaseCode + '.png')"
class="tempStyle"
style="width: 300px; height: 450px; padding: 5px; display: block; margin: 0 auto; border: 1px solid #dcdfe6"
/>
2.写死的src
<img
v-else
src="'@/assets/images/88880001.png'"
class="tempStyle"
style="width: 300px; height: 450px; padding: 5px; display: block; margin: 0 auto; border: 1px solid #dcdfe6"
/>