0

I want to show DB data using Vuejs. I want to show some product codes. It shows well as I expected. I want to show now description instead of code. But when I try it other prices and all things are changing.

I have mentioned below tried code ->

<template v-for="(chosen_configuration, index) in quote.chosen_configurations">
    <td colspan="3">
      <select id="configuration" name="configuration" v-model="quote.chosen_configurations[index]">
        <option v-for="configuration in quote.configurations" v-text="configuration.configuration_code"></option>
      </select>
    </td>
</template>

I want to show configuration.description instead of v-text="configuration.configuration_code" But when I try v-text="configuration.description" it not workes.

How can I show data using configuration.description without changing v-text="configuration.configuration_code". Is that possible ?

3
  • 1
    What exactly you want to display? <option></option> has two required attributes, value and text. Ex. <option value="test">Test</option> Commented Jun 25, 2020 at 10:37
  • 2
    What do you mean by all things are changing? It is nice that you provided the code but we lack the context or the data model, do you have a sample js object or json to show that? Commented Jun 25, 2020 at 10:37
  • Isn't <option v-for="configuration in quote.configurations" v-text="configuration.description"></option> what you need? Commented Jun 25, 2020 at 10:39

1 Answer 1

1

Am adding the code you need, If we understood exactly your request. If it is what you're looking for, accept it as a solution.

<template v-for="(chosen_configuration, index) in quote.chosen_configurations">
  <td colspan="3" :key="index">
    <select id="configuration" name="configuration" v-model="quote.chosen_configurations[index]">
      <option v-for="(configuration, j) in quote.configurations" :key="j" v-text="configuration.description" :value="configuration.configuration_code"></option>
    </select>
  </td>
</template>
Sign up to request clarification or add additional context in comments.

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.