S
S
Stim72021-01-12 11:14:04
Vue.js
Stim7, 2021-01-12 11:14:04

Vuetify - how to make an element active?

Hello everyone, tell me how to make a node in the v-treeview component active when the page is refreshed?
5ffd59ff2338a954391343.png
Should be:
5ffd5a0f19a2a210093286.png

<template>
  <v-treeview
    :items='backgroundTasks'
    activatable
    item-key='id'
    open-on-click
    color='red'
    return-object
    hoverable
    @update:active='selectTab'
  >
    <template v-slot:prepend='{ item }'>
      <v-icon>mdi-clipboard-list</v-icon>
    </template>
    <template slot-scope='{ item }'>
      <a @click='selectTab(item)'></a>
    </template>
  </v-treeview>
</template>

Thanks to all!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
ReaverJS, 2021-01-12
@ReaverJS

Наверное только через хуки.
beforeMount() {
  for (let item of backgroundTasks) {
    if (this.$router.currentRoute === item.url) this.selectTab = item.id;
  }
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question