In Vue: src can't find resources?

.vue

<ul>
    <li v-for="brand in brands">
        <img :src="brand.img_url" alt="">
        <span>{{brand.text}}</span>
    </li>
</ul>



brands: [
    {
        img_url: "./images/icon-aodi.png",
        text: ""
    }
]

directory structure



but directly src= ". / images/icon-aodi.png" can be displayed normally

Mar.01,2021

this route is based on the path of the html file where the code ends up, not on the .vue file


there are two ways:
1, storing resources under / static/, referencing
2, and passing in image coding through require (path)

.

reference: https://m.jb51.net/article/11.

alas, you should do it yourself and have plenty of food and clothing.

Menu