Because the image won't live in /assets/visa.png! Everything in the assets folder, if it is used, will be deployed to an img/ directory if it's not turned into a dataurl.
Because it lives in the src/ directory in the project, it's not accessible once the project is built for production. Using require() lets the Vue CLI (actually webpack) know that you're using it and is then deployed properly during the build process. You can read more about that at Static Assets Handling in the Vue CLI documentation.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Can't you just return the absolute path without FQDN like
/assets/visa.png
instead?Because the image won't live in
/assets/visa.png
! Everything in the assets folder, if it is used, will be deployed to animg/
directory if it's not turned into a dataurl.Because it lives in the
src/
directory in the project, it's not accessible once the project is built for production. Usingrequire()
lets the Vue CLI (actually webpack) know that you're using it and is then deployed properly during the build process. You can read more about that at Static Assets Handling in the Vue CLI documentation.