Skip to content

Commit 700efd7

Browse files
committed
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.
1 parent 25484a9 commit 700efd7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/layout/components/Footer/src/Footer.vue

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,16 @@ const prefixCls = getPrefixCls('footer')
1212
const appStore = useAppStore()
1313
1414
const title = computed(() => appStore.getTitle)
15+
16+
// 添加当前年份计算属性
17+
const currentYear = computed(() => new Date().getFullYear())
1518
</script>
1619

1720
<template>
1821
<div
1922
:class="prefixCls"
2023
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"
2124
>
22-
<span class="text-14px">Copyright ©2022-{{ title }}</span>
25+
<span class="text-14px">Copyright ©{{ currentYear }} {{ title }}</span>
2326
</div>
2427
</template>

0 commit comments

Comments
 (0)