Home  >  Article  >  Web Front-end  >  How to dynamically change static images and request network images in vue

How to dynamically change static images and request network images in vue

亚连
亚连Original
2018-06-07 13:59:382861browse

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

express builds query server

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn