You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

71 lines
1.3 KiB

2 years ago
  1. <template>
  2. <v-breadcrumbs :items="routes">
  3. <template #divider>
  4. <v-icon>mdi-chevron-right</v-icon>
  5. </template>
  6. </v-breadcrumbs>
  7. </template>
  8. <script>
  9. export default {
  10. name: "Breadcrumbs",
  11. data() {
  12. return {
  13. width: undefined,
  14. };
  15. },
  16. created() {
  17. if (process.client) {
  18. this.width = window.innerWidth;
  19. }
  20. },
  21. mounted() {
  22. this.$nextTick(() => {
  23. window.addEventListener("resize", this.onResize);
  24. });
  25. },
  26. beforeDestroy() {
  27. window.removeEventListener("resize", this.onResize);
  28. },
  29. computed: {
  30. windowWidth() {
  31. if (process.client) {
  32. this.width = window.innerWidth;
  33. }
  34. return this.width;
  35. },
  36. routes() {
  37. const { matched } = this.$nuxt.$route;
  38. const home = {
  39. text: "ShowEasy",
  40. href: this.localePath("/"),
  41. disabled: false,
  42. };
  43. return [
  44. home,
  45. ...matched.map(({ meta, path }) => {
  46. const route = {
  47. text: meta.name,
  48. href: this.localePath(path),
  49. disabled: false,
  50. };
  51. return route;
  52. }),
  53. ];
  54. },
  55. },
  56. methods: {
  57. onResize() {
  58. if (process.client) {
  59. this.width = window.innerWidth;
  60. }
  61. },
  62. },
  63. };
  64. </script>
  65. <style lang="scss" scoped>
  66. :deep() {
  67. .v-breadcrumbs__item {
  68. color: black !important;
  69. }
  70. }
  71. </style>