(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(() => { onUnmounted(() => {
props.target.removeEventListener("scroll", checkInWindow); props.target.removeEventListener("scroll", checkInWindow);
}); });
</script> </script>

View File

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

View File

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

View File

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