简体   繁体   中英

change title with variable in v-tab with vue.js

Hi wanna change the infos title with this varibale {{ siteParts.serial_no }} how can i do this ?

 <v-tab title="infos">
 <div v-for="siteParts in sitePartGSM">
 {{ siteParts.serial_no }}
 <div class="description" v-for="item in siteParts.part_attributes">
 <small><strong>{{item.x_name}}</strong> {{item.x_value}}</small>
 </div>
 </div>
 </v-tab>

thank you for your help

If I well understood your question... v-tab is outside the div with v-for (which is an array). So you can set a v-tab for each sitePartGSM or just show the title for a specific item.

1st solution:

 <div v-for="siteParts in sitePartGSM">
     <v-tab :title="siteParts.serial_no">

2nd: solution:

 <v-tab :title="sitePartGSM[0].serial_no" v-if="sitePartGSM[0]">
     <div v-for="siteParts in sitePartGSM">

In both case remember to add : before title attribute.

您可以使用v-bind来实现。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM