I can't seem to find anything stating a way to use the @
src alias inside of a computed property. Is this possible?
I would like to dynamically assign an img src based on the component type. But computed property will only return back the literal string value.
computed: {
dynamicImgSrc() {
return '@/assets/icons/myImage.svg';
}
}
CodePudding user response:
Use require for relative path imports in javascript
return require('@/assets/icons/myImage.svg')