(component): 简化 breadcrumb 代码

This commit is contained in:
就眠儀式 2022-10-18 00:04:08 +08:00
parent 60aaa9fea2
commit 1c804c6db9
4 changed files with 8 additions and 11 deletions

View File

@ -134,4 +134,4 @@ onMounted(() => {
onUnmounted(() => {
props.target.removeEventListener("scroll", checkInWindow);
});
</script>
</script>

View File

@ -30,9 +30,8 @@ const classes = computed(() => {
});
const styles = computed<StyleValue>(() => {
return [props.color ? `background-color: ${props.color}` : ""]
})
return [props.color ? `background-color: ${props.color}` : ""];
});
</script>
<template>

View File

@ -8,11 +8,11 @@ export default {
import "./index.less";
import { provide, withDefaults } from "vue";
export interface LayBreadcrumbProps {
export interface BreadcrumbProps {
separator?: string;
}
const props = withDefaults(defineProps<LayBreadcrumbProps>(), {
const props = withDefaults(defineProps<BreadcrumbProps>(), {
separator: "/",
});

View File

@ -12,15 +12,13 @@ export default {
</script>
<script setup lang="ts">
import { inject, useSlots } from "vue";
import { inject } from "vue";
export interface LayBreadcrumbItemProps {
export interface BreadcrumbItemProps {
title?: string;
}
const slot = useSlots();
const props = defineProps<LayBreadcrumbItemProps>();
const props = defineProps<BreadcrumbItemProps>();
const separator = inject("separator");
</script>