feat: add current year calculation to footer component

- 根据"DRY"(Don't Repeat Yourself)原则,使用动态年份代替硬编码,确保年份始终保持最新
- Introduced a new computed property `currentYear` in `Footer.vue` to dynamically display the current year in the copyright notice.
- Updated the copyright span to use `currentYear` instead of a hardcoded year, enhancing maintainability and accuracy.
This commit is contained in:
AhJindeg 2025-01-03 15:20:04 +08:00
parent 25484a941b
commit 700efd7ee2

View File

@ -12,6 +12,9 @@ const prefixCls = getPrefixCls('footer')
const appStore = useAppStore()
const title = computed(() => appStore.getTitle)
//
const currentYear = computed(() => new Date().getFullYear())
</script>
<template>
@ -19,6 +22,6 @@ const title = computed(() => appStore.getTitle)
:class="prefixCls"
class="h-[var(--app-footer-height)] bg-[var(--app-content-bg-color)] text-center leading-[var(--app-footer-height)] text-[var(--el-text-color-placeholder)] dark:bg-[var(--el-bg-color)] overflow-hidden"
>
<span class="text-14px">Copyright ©2022-{{ title }}</span>
<span class="text-14px">Copyright ©{{ currentYear }} {{ title }}</span>
</div>
</template>