Home > Web Front-end > JS Tutorial > body text

About the method of inserting variable parameters in vue.js tag attributes (detailed tutorial)

亚连
Release: 2018-06-01 09:20:12
Original
3224 people have browsed it

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="{&#39;selected&#39;:index===clickIndex}" @click="selected(index)">
                <p>
                  <h3>{{item}}点位标签</h3>
                  <span style="margin: 15px 0px;">附近的资产:3个(2个未完成修订)</span><br />
                  <img :src="&#39;img/&#39;+(item+nameIndex)+&#39;.jpg&#39;" />
                  <a href="#" rel="external nofollow" ></a>
                </p>
              </li>
    </ul>
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!