Home  >  Q&A  >  body text

javascript - Why can only fixed values ​​be passed in vue router-link to?

 <router-link to="'/intro/'+item.id">
                        <p class="gradual"><span>{{item.name}}</span><br>{{item.name}}</p>
                        <img class="store_img" :src="item.pic">
                    </router-link>

Why the connection is written like this #/'/intro/' item.id
How to transfer dynamic values

滿天的星座滿天的星座2662 days ago893

reply all(3)I'll reply

  • 天蓬老师

    天蓬老师2017-07-06 10:36:47

    To be dynamic, the attributes do not add : (abbreviation of v-bind:), it is a static attribute. Whatever is passed is what it is. Otherwise, the expression

    can be passed in
    :to="'/intro/'+item.id"

    OR

    v-bind:to="'/intro/'+item.id"

    reply
    0
  • 滿天的星座

    滿天的星座2017-07-06 10:36:47

    to ===> :to

    reply
    0
  • 怪我咯

    怪我咯2017-07-06 10:36:47

    to is the element attribute you added. :to is an attribute that Vue can recognize and parse, and the content after :to will be executed as an expression.

    reply
    0
  • Cancelreply