Vue.js how to set :id prefix string?

If you have a unique id, do, you can just do like this:

<ul>
    <li v-for="item in ritems" :id="['Row_' + item.id]">
        {{something}}
    </li>
</ul>

if you don't have a unique id, do this

<ul>
    <li v-for="(item , index) in ritems" :id="['Row_' + index]">
        {{something}}
    </li>
</ul>

in both, the result will be like this:

<ul>
    <li id="Row_12">
        something
    </li>
</ul>

You can just do, code should be self explanatory:

<div v-for="(tabTitle, index) in tabTitleList">
    <span :id="'sp_' + index"> {{tabTitle}} </span>
</div>

Documentation link.

Tags:

Vue.Js

Vuejs2