[Vue] Two types of template syntax

Classification

Interpolation syntax

https://blog.csdn.net/m0_50939789/article/details/128458565

Command syntax
  1. v-bindOne-way binding

    The content wrapped in quotation marks is v-bind:treated as an expression, and a value can be bound to the quotation marks in any tag.

    <a v-bind:href="url">关于我</a>
    
    const nav_Vue = new Vue({
          
          
       el: '#nav_content', 
        data: {
          
          
            url: "./aboutme.html"
        }
    })
    

    v-vbind:abbreviation:

    <a :href="url">关于我</a>
    

    Notice:

    1. The content inside the quotation marks is an expression

    2. Data can only dataflow from to the page, not from the page todata

  2. v-modelTwo-way binding

    Using valuethe value of the form class, data not only flows from datathe to the page, but also from the page todata

    v-model: value = "xxx"The abbreviation since it is mainly used for values v-model = "xxx"​​of form classesvalue

The difference between the two types of grammar

  • Interpolation syntax: tag body content
  • Command syntax: label attributes

Guess you like

Origin blog.csdn.net/m0_50939789/article/details/128459695