1

I have the following in a vue.js script:

<v-tab v-for="type in searchTypes" :id="type.value" :key="type.value" @click="getSelectValue(type.value)">

I want to append the id of "type.value" with a fixed string "_tab"

I have tried various ways without getting it to work. Any help is appreciated. thank you

3 Answers 3

1

You can use javascript expressions to contat the string like this:

<v-tab v-for="type in searchTypes" :id="type.value + '_tab'" :key="type.value" @click="getSelectValue(type.value)">

I hope this can help you here is the source:

Using JavaScript Expressions

Sign up to request clarification or add additional context in comments.

Comments

0

Just use string interpolation:

<v-tab v-for="type in searchTypes" :id="`${type.value}_tab`" :key="type.value" @click="getSelectValue(type.value)">

Comments

0

You can use template literal syntax to do that. I'm a React guy, but I think this will work. Hopefully I understood the question correctly.

<v-tab v-for="type in searchTypes" :id="`_tab${type.value}`" :key="type.value" @click="getSelectValue(type.value)">

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.