Selaa lähdekoodia

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.
AhJindeg 7 kuukautta sitten
vanhempi
commit
700efd7ee2
1 muutettua tiedostoa jossa 4 lisäystä ja 1 poistoa
  1. 4 1
      src/layout/components/Footer/src/Footer.vue

+ 4 - 1
src/layout/components/Footer/src/Footer.vue

@@ -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>