How to get params from an event vuetify vue js

Viewed 69

I am learning vuetify and vue js and I want to know how to get params when I click on my treeview :

example :

in the console chrome with vue extension I have : vue event update:active (this gives me the id of the element in my treeview)

And I want to compare the params in a function to do some actions when I click on an element of my treeview, how can I do that ?

 <v-treeview
  v-if="userExists"
  hoverable
  open-on-click
  @update:active="openRoute"
  :items="items"
  activatable>

  </v-treeview>

and the function I made

function openRoute () {
  const routes = _.map(items, function (item) {
    if (item.name === 'Structure') { // here I want to compare with the id 
      return item.routeName
    }
  })
  const test = routes.toString()
  context.root.$router.push({ name: routes })
}

Thank you for you help

1 Answers

You can simply add the parameter to your function. For example:

function openRoute (emitedValue) {
  console.log(emitedValue);
  const routes = _.map(items, function (item) {
    if (item.name === 'Structure') { // here I want to compare with the id 
      return item.routeName
    }
  })
  const test = routes.toString()
  context.root.$router.push({ name: routes })
}
Related