Let's take a look at the dynamic splicing of img in Vue: src picture address, the specific content is as follows: Usage scenario: Match local image resources according to the image tag returned by the backend. For example: According to the k1 tag returned by the backend, the front end generates the image resource path assets/images/inventory/k1.png <template> <div class="fl"> <img :src="getImgUrl(gatherInfo.img1)" alt=""> <img :src="getImgUrl(gatherInfo.img2)" alt=""> <img :src="getImgUrl(gatherInfo.img3)" alt=""> </div> </template> data(){ return { gatherInfo: title: 'Inventory summary information', img1: 'k1', img2: 'k2', img3: 'k3', }, } } In methods //Get the image address getImgUrl (img) { return require("@/assets/images/inventory/" + img+ ".png"); }, This is the end of this article about dynamic splicing of img in Vue: src image address. For more relevant vue img dynamic splicing content, please search 123WORDPRESS.COM's previous articles or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: How to configure MySQL8 in Nacos
>>: How to install tomcat in docker and deploy the Springboot project war package
RedHat6.5 installation MySQL5.7 tutorial sharing,...
Preface The master-slave replication relationship...
Table of contents 1 Difference 1.1 Space Occupanc...
I recently started learning Linux. After reading ...
In general applications, we use timestamp, dateti...
When we are doing front-end development, we will ...
Why is the title of the article “Imitation Magnif...
Method 1: Use Google advanced search, for example...
Table of contents 1. The difference between trans...
Table of contents 1. Globally registered componen...
JS running trilogy js running code is divided int...
Using abbreviations can help reduce the size of yo...
1. Installation Package MYSQL service download ad...
This article records the detailed process of down...
In the past, it was quite troublesome to achieve ...