Below I will share with you an article on how Vue uses v-for to assign values to the src attribute. It has a good reference value and I hope it will be helpful to everyone.
My code structure is as shown in the code below, which cannot be executed. The mustache notation cannot be used in the src attribute in img
new Vue({ el: "#test", data: function () { return { lists: [ { img : 'img1' }, { img : 'img2' }, { img : 'img3' }, { img : 'img4' } ] } }, })
Later I changed the code in the html to the following
After using the v-bind tag, you can use it normally
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future.
Related articles:
JS method of traversing irregular multi-dimensional arrays
Vue project closes eslint verification
Two methods to remove code specification detection in vue
The above is the detailed content of How to assign value to src attribute through Vue using v-for (detailed tutorial). For more information, please follow other related articles on the PHP Chinese website!
Introduction to article tag attributes
String array assignment method
delete folder in linux
The difference between console cable and network cable
How to set up the router
How to restore videos that have been officially removed from Douyin
Introduction to commonly used top-level domain names
What is the email address and how to fill it in?