moreta / vue-search-select

A Vue.js search select component
https://vue-search-select.netlify.com
MIT License
402 stars 127 forks source link

Not able to use nested attributes #143

Open Cigoler opened 4 years ago

Cigoler commented 4 years ago

https://codesandbox.io/s/vue-template-rev9c

suppliers: [
        { id: 1, supplier_id: 22, supplier: {
          id: 22, 
          name: "Supplier One"
        } }, { id: 2, supplier_id: 32, supplier: {
          id: 32, 
          name: "Supplier Two"
        } },
      ],
<model-list-select
      :list="suppliers"
      option-value="id"
      option-text="supplier.name"
      v-model="form.supplier"
      placeholder="supplier"
      class="form-control col-md-7 col-xs-12"
    ></model-list-select>

I can't get it to work with a list like this. It won't accept supplier.name for the option text. It just displays blank. If I put in supplier then I can see the data is there and available as the name is now: { "supplier_id": 32, "name": "Supplier Two" } Help appreciated if it's (likely) just me being dense.

vanrijs commented 3 years ago

+1