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
This article example shares the specific code of ...
Background <br />Students who work on the fr...
Copy code The code is as follows: @charset "...
If you only want to back up a few tables or a sin...
Table of contents 1. What is grub encryption 2. g...
<br />Original text: http://research.microso...
Preface Regarding HugePages and Oracle database o...
What is NFS? network file system A method or mech...
Think about it: Why should css be placed in the h...
This article discusses the difficulties and ideas...
Preface I recently used :first-child in a project...
1. Experimental Environment serial number project...
Preface Vue Router is the official routing manage...
This article shares the specific code of JavaScri...
Preface With the crazy speculation of virtual cur...