-
Notifications
You must be signed in to change notification settings - Fork 0
/
global-top.vue
56 lines (48 loc) · 1.4 KB
/
global-top.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<template>
<div class="pointer-events-none">
<span class="cur-page" v-show="showPage"
>{{ page }}<sub class="page-count">/{{ pageCount }}</sub></span
>
</div>
</template>
<script setup lang="ts">
import { SlidevContextNav, SlidevContextNavClicks } from '@slidev/client/modules/context'
import { computed, UnwrapNestedRefs } from 'vue'
// @ts-ignore
const nav: UnwrapNestedRefs<SlidevContextNav & SlidevContextNavClicks> = $slidev.nav
const page = computed(() => nav.currentPage)
const pageCount = computed(() => nav.total)
const showPage = computed(() => {
return page.value !== 1 && page.value !== pageCount.value + 1
})
const progress = computed(() => {
return `${((nav.clicks + 1) / (nav.clicksTotal + 1)) * 100}%`
})
</script>
<style scoped lang="less">
.cur-page {
position: absolute;
bottom: 1rem;
right: 2rem;
font-weight: bold;
filter: brightness(0);
mix-blend-mode: difference;
&::after {
@scale: 1.2;
@size: calc(0.7em / @scale);
content: '';
display: inline-block;
width: @size;
height: @size;
margin-left: 0.5em;
border-radius: @size;
border: 1px solid;
background: conic-gradient(black v-bind(progress), transparent v-bind(progress));
transition: all 0.2s ease-in-out;
transform: scale(@scale);
}
}
.page-count {
opacity: 0.2;
}
</style>