" Variable parameters are enough."/> " Variable parameters are enough.">

Home  >  Article  >  Web Front-end  >  How to insert variables in vuejs

How to insert variables in vuejs

藏色散人
藏色散人Original
2021-10-27 14:39:212916browse

Vuejs method of inserting variable parameters: 1. Open the corresponding js code; 2. Through "

  • " method to insert variable parameters.
  • How to insert variables in vuejs

    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:

    How to insert variables in vuejs

    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)">
                                    <div>
                                        <h3>{{item}}点位标签</h3>
                                        <span style="margin: 15px 0px;">附近的资产:3个(2个未完成修订)</span><br />
                                        <img  :src="&#39;img/&#39;+(item+nameIndex)+&#39;.jpg&#39;" / 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!

    Statement:
    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