I've been trying to pass a prop to a component, which is a URL to an image for Section component to update v-bind:src of dom img tag, but somehow the image does not show up.
I can't see what's wrong.
File: App.vue
<template> <div id="app"> <Section img="../assets/linux.png" /> </div> </template> <script> import Section from "./components/Section.vue"; export default { name: "app", components: { Section } }; </script> File: Section.vue
<template> <div> <img :src="img" /> </div> </template> <script> export default { props: { img: String } }; </script>
imgprop. In fact, what you've posted would break. Since OP is passing a string and no reactivity is needed, there is no need to bind. If the OP were to choose to bind the prop, they would have to quote the image source like this :<Section :img="'../assets/linux.png'" />, but the whole thing is quite unnecessary.:img="require('../assets/linux.png')"