This article mainly introduces the method of inserting variable parameters in vue.js into tag attributes. It is very good and has reference value. Friends in need can refer to the attributes of tags in
html, such as id. , class, and href need to dynamically pass parameters and splice strings. After checking some information, I did not find a suitable solution. After thinking about it all morning, I finally tried the method:
v-bind: Attribute = "'String' custom variable name", I tried it myself and it worked fine, friends in need can learn from it!
Finally, you need to note that the attribute must be ":attribute="This form will work
<ul class="menu" v-for="(item,index) in 4"> <li :class="{'selected':index===clickIndex}" @click="selected(index)"> <p> <h3>{{item}}点位标签</h3> <span style="margin: 15px 0px;">附近的资产:3个(2个未完成修订)</span><br /> <img :src="'img/'+(item+nameIndex)+'.jpg'" /> <a href="#" rel="external nofollow" ></a> </p> </li> </ul>
The above is what I compiled for everyone, I hope it will be useful in the future Everyone is helpful.
Related articles:
vue2.0 computed Example of calculating the accumulated value after list loop
Use v-for traversal in vue Two-dimensional array method
Data grouping example of v-for in Vue
The above is the detailed content of About the method of inserting variable parameters in vue.js tag attributes (detailed tutorial). For more information, please follow other related articles on the PHP Chinese website!