Home > Article > Web Front-end > How to dynamically change static images and request network images in vue
Below I will share with you an implementation method of dynamically changing static images in Vue and requesting network images. It has a good reference value and I hope it will be helpful to everyone.
In your own project, you need to dynamically request back-end images
Generally you need to write it in created because the image cannot come through beforeCreate. If you want to request data at this time, then the address of the image We have to exist somewhere. It can be local or in vuex
If you want to add or change static images dynamically, we need to change the directory structure of the image
Put the image in static and then imgUrl :
['/static/clinical.png','/static/nursing.png','/static/function.png','/static/test.png','/static/drug. png','/static/admin.png']
Absolute path request
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
Cross-domain issues with proxyTable in the vue-cli project
Use js custom trim function to delete spaces at both ends
The above is the detailed content of How to dynamically change static images and request network images in vue. For more information, please follow other related articles on the PHP Chinese website!