Using dynamic path in Vue CLI
Posted on July 18, 2019
If you want to pass a dynamic path to an img
tag using the CLI of Vue (meaning Webpack), here the little gem:
<img :src="require(`@/assets/${myVarOrMethod}`)" />
Happy Vue diving
Posted on July 18, 2019
If you want to pass a dynamic path to an img
tag using the CLI of Vue (meaning Webpack), here the little gem:
<img :src="require(`@/assets/${myVarOrMethod}`)" />
Happy Vue diving