riophae / vue-treeselect

A multi-select component with nested options support for Vue.js
https://vue-treeselect.js.org/
MIT License
2.91k stars 509 forks source link

Where to write matchKeys prop #421

Open TimaBuldzer opened 4 years ago

TimaBuldzer commented 4 years ago

Hello! where to write this matchKeys prop? Please help

TimaBuldzer commented 4 years ago

and how to write it? i want 'name' instead of 'label'

ArtyomCarman commented 3 years ago

and how to write it? i want 'name' instead of 'label'

use :normalizer="normalizer"

export default {
...
data() {
  return {
     normalizer(node) {
      return {
        id: node.id,
        label: node.name,
        children: node.children,
      }
    },
  }
}
...
}

for more details look here https://vue-treeselect.js.org/#customize-key-names

juan-rivera-2020 commented 3 years ago

Just ran into this issue. I used normalizer but it didn't fix issue as matchKeys value was still 'label', the default value. In order to change the matchValue prop, it's a matter of using the write syntax. This worked for me:

              <treeselect  
                  placeholder="Search and select" 
                  :multiple="true"                   
                  :normalizer="normalizer"                         
                  :options="portfolioPrograms" 
                  valueFormat="object"
                  :match-keys="['example_id']"
                  v-model="C_portfolioNamesFilter"
                />