Skip to content

Commit d692b75

Browse files
authored
feat: temporary grayscale
1 parent 8a16bf1 commit d692b75

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

src/App.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
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'
1818
import GlobalHeader from './components/GobalHeader.vue'
1919
import 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>

0 commit comments

Comments
 (0)