" Variable parameters are enough."/> " Variable parameters are enough.">
Home > Article > Web Front-end > How to insert variables in vuejs
Vuejs method of inserting variable parameters: 1. Open the corresponding js code; 2. Through "
" method to insert variable parameters.
The operating environment of this article: Windows 7 system, Vue version 2.9.6, Dell G3 computer.
How to insert variables in vuejs?
vue.js inserts variable parameters into tag attributes:
html tag attributes, such as id, class, href, need to dynamically pass parameters and splice them String, I checked some information, but 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)"> <div> <h3>{{item}}点位标签</h3> <span style="margin: 15px 0px;">附近的资产:3个(2个未完成修订)</span><br /> <img :src="'img/'+(item+nameIndex)+'.jpg'" / alt="How to insert variables in vuejs" > <a href="#"></a> </div> </li> </ul>
Recommendation: "The latest 5 vue.js video tutorial selections》
The above is the detailed content of How to insert variables in vuejs. For more information, please follow other related articles on the PHP Chinese website!