File tree Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Expand file tree Collapse file tree 1 file changed +15
-3
lines changed Original file line number Diff line number Diff line change 1313</template >
1414
1515<script setup lang="ts">
16- import { defineComponent , defineProps , ref } from ' vue'
16+ import { defineComponent , onMounted , ref } from ' vue'
1717// import { useI18n } from 'vue-i18n'
1818import GlobalHeader from ' ./components/GobalHeader.vue'
1919import GlobalFooter from ' ./components/GlobalFooter.vue'
@@ -27,7 +27,19 @@ const components = defineComponent({
2727 SearchModal ,
2828 NProgress ,
2929})
30- // const props = defineProps()
30+
31+ /**
32+ * 伟人纪念日限时灰度滤镜
33+ */
34+ onMounted (() => {
35+ const start = new Date (' 2022-12-06T00:00:00+0800' ).getTime ()
36+ const end = new Date (' 2022-12-06T23:59:59+0800' ).getTime ()
37+ const now = Date .now ()
38+
39+ if (now > start && now < end ) {
40+ document .documentElement .style .filter = ' grayscale(1)'
41+ }
42+ })
3143 </script >
3244
3345<style scoped lang="sass">
@@ -39,4 +51,4 @@ article
3951 margin-left : 5%
4052 margin-right : 5%
4153 padding : 2rem 0 3rem 0
42- </style >
54+ </style >
You can’t perform that action at this time.
0 commit comments