Преглед изворни кода

✨ 2023-06-25:perf: 优化锁屏组件

(cherry picked from commit d884f71d5701bd3b9242d5a5076bbfd783ee9ba9)
YunaiV пре 1 година
родитељ
комит
6a3a215768

+ 1 - 1
src/components/Editor/src/Editor.vue

@@ -180,7 +180,7 @@ defineExpose({
 </script>
 
 <template>
-  <div class="z-99 border-1 border-[var(--el-border-color)] border-solid">
+  <div class="border-1 border-solid border-[var(--tags-view-border-color)] z-10">
     <!-- 工具栏 -->
     <Toolbar
       :editor="editorRef"

+ 1 - 1
src/layout/components/UserInfo/src/components/LockPage.vue

@@ -2,7 +2,7 @@
 import { resetRouter } from '@/router'
 import { useCache } from '@/hooks/web/useCache'
 import { useLockStore } from '@/store/modules/lock'
-import { useNow } from './useNow'
+import { useNow } from '@/hooks/web/useNow'
 import { useDesign } from '@/hooks/web/useDesign'
 import { useTagsViewStore } from '@/store/modules/tagsView'
 import { useUserStore } from '@/store/modules/user'

+ 0 - 60
src/layout/components/UserInfo/src/components/useNow.ts

@@ -1,60 +0,0 @@
-import { dateUtil } from '@/utils/dateUtil'
-import { reactive, toRefs } from 'vue'
-import { tryOnMounted, tryOnUnmounted } from '@vueuse/core'
-
-export function useNow(immediate = true) {
-  let timer: IntervalHandle
-
-  const state = reactive({
-    year: 0,
-    month: 0,
-    week: '',
-    day: 0,
-    hour: '',
-    minute: '',
-    second: 0,
-    meridiem: ''
-  })
-
-  const update = () => {
-    const now = dateUtil()
-
-    const h = now.format('HH')
-    const m = now.format('mm')
-    const s = now.get('s')
-
-    state.year = now.get('y')
-    state.month = now.get('M') + 1
-    state.week = '星期' + ['日', '一', '二', '三', '四', '五', '六'][now.day()]
-    state.day = now.get('date')
-    state.hour = h
-    state.minute = m
-    state.second = s
-
-    state.meridiem = now.format('A')
-  }
-
-  function start() {
-    update()
-    clearInterval(timer)
-    timer = setInterval(() => update(), 1000)
-  }
-
-  function stop() {
-    clearInterval(timer)
-  }
-
-  tryOnMounted(() => {
-    immediate && start()
-  })
-
-  tryOnUnmounted(() => {
-    stop()
-  })
-
-  return {
-    ...toRefs(state),
-    start,
-    stop
-  }
-}