Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vuetify breadcrumbs scoped slot

I'm trying to incorporate breadcrumbs into my vuetify app however this is my code:

<v-breadcrumbs divider=">">
    <v-breadcrumbs-item
        v-for="breadcrumb in breadcrumbs"
        exact
        :to="breadcrumb.to">
        {{ breadcrumb.text }}
    </v-breadcrumbs-item>
</v-breadcrumbs>

And then I get this warning in the console. Im not really sure what it means..

default slot' is deprecated, use ':items and scoped slot "item"' instead

If i try the default template from vuetify docs: <v-breadcrumbs :items="items"> it only allows for a href not a :to which is what I need.

Can anyone help me out.

like image 760
Brad Avatar asked Dec 07 '22 12:12

Brad


2 Answers

It seems that Veutify now provides an item scoped slot that can be used to customize breadcrumbs. Looking at their example here I think what you need to do is the following ..

<v-breadcrumbs :items="breadcrumbs" divider=">">
    <v-breadcrumbs-item
        slot="item"
        slot-scope="{ item }"
        exact
        :to="item.to">
        {{ item.text }}
    </v-breadcrumbs-item>
</v-breadcrumbs>
like image 168
Husam Ibrahim Avatar answered Dec 11 '22 07:12

Husam Ibrahim


alternative is use a method with a click event

<template>
  <v-breadcrumbs divider=">">
    <v-breadcrumbs-item
        v-for="breadcrumb in breadcrumbs"
        exact
        @click="goTo(breadcrumb.to)">
        {{ breadcrumb.text }}
    </v-breadcrumbs-item>
  </v-breadcrumbs>
</template>

<script>
  export default {
    methods: {
      goTo (payload) {
        this.$router.push(payload)
      }
    }
  }
</script>
like image 36
Kent Dela Cruz Fueconcillo Avatar answered Dec 11 '22 09:12

Kent Dela Cruz Fueconcillo