No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Q-Select options from object

    Help
    1
    1
    1806
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      stefanopav last edited by

      Hello,

      I am making one select which is getting its options by one custom object instead of an array of strings.
      I made it work but I can’t get why it is working.

      Options array

      treatmentCatsData = [{ id: 1, cat: 'cat1' }, { id: 2, cat: 'cat2' } ]
      

      Not working template

      <q-select
        v-model="treatmentCat"
        :options="treatmentCatsData"
        :option-value="id"
        :option-label="cat"
        label="Categoria di trattamento"
        name="treatmentCat"
        emit-value
        map-options
      ></q-select>
      

      Working template

      <q-select
        v-model="treatmentCat"
        :options="treatmentCatsData"
        :option-value="'id'"
        :option-label="'cat'"
        label="Categoria di trattamento"
        name="treatmentCat"
        emit-value
        map-options
      ></q-select>
      

      As per documentation here, I should the html properties “option-value” and “option-label” should accept the object properties names, not strings representing the object property name.

      Am I misunderstanding something?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post