How to pass in a picture address as a property when using a component

this component has an icon, so you want to pass in the image address of a relative path when using it.
has been tested and found to be feasible in the static folder under the root directory. But pictures are usually placed in the same directory as vue files, so is there a better solution?

Feb.28,2021


<template>
    <div>
       <MyComponent :icon=compomentIcon></MyComponent>    
    </div>
</template>

<script>
    import MyComponent from 'path'
    import componentImg  from 'imgpath'
    export default {
        data(){
            return {
                compomentIcon: componentImg
            }
        },
        components: {
            MyComponent
        }
       
    }
</script>
Menu