breadcrumb.vue 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <template>
  2. <!-- 面包屑组件 -->
  3. <div class="breadcrumb flex-row-center" :style="{ 'background': meta.breadcrumbColor ? meta.breadcrumbColor : '#ffffff' }">
  4. <div class="breadcrumb-bos flex-row-start">
  5. <div class="home" @click="onPath('/index')">首页</div>
  6. <template v-if="meta.navList && meta.navList.length > 0">
  7. <div v-for="(item, index) in meta.navList" :key="index" class="nav-list">
  8. <el-icon style="margin: 0 4px"><ArrowRight /></el-icon>
  9. <div @click="goPath(item)" class="like">{{ item.title || '' }}</div>
  10. </div>
  11. </template>
  12. <el-icon style="margin: 0 4px"><ArrowRight /></el-icon>
  13. <div>{{ meta.title || '' }}</div>
  14. </div>
  15. </div>
  16. </template>
  17. <script setup lang="ts">
  18. import { onPath } from '@/utils/siteConfig';
  19. const router = useRouter();
  20. const route = useRoute();
  21. const meta = ref<any>({});
  22. meta.value = route.meta;
  23. watch(route, () => {
  24. meta.value = route.meta;
  25. });
  26. const goPath = (res: any) => {
  27. router.push(res.url);
  28. };
  29. </script>
  30. <style lang="scss" scoped>
  31. .breadcrumb {
  32. width: 100%;
  33. height: 44px;
  34. background: #ffffff;
  35. .breadcrumb-bos {
  36. max-width: 1500px;
  37. min-width: 1200px;
  38. width: 100%;
  39. font-size: 14px;
  40. color: #101828;
  41. .nav-list {
  42. height: 44px;
  43. display: flex;
  44. align-items: center;
  45. .like {
  46. cursor: pointer;
  47. &:hover {
  48. color: var(--el-color-primary);
  49. }
  50. }
  51. }
  52. .home {
  53. cursor: pointer;
  54. &:hover {
  55. color: var(--el-color-primary);
  56. }
  57. }
  58. }
  59. }
  60. </style>