-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathPinyin.vue
61 lines (52 loc) · 979 Bytes
/
Pinyin.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
57
58
59
60
61
<script lang="ts" setup>
import { defineProps } from "vue";
defineProps<{
chars: string[];
}>();
</script>
<template>
<div class="pinyin-input">
<div v-for="(char, ci) in chars" :key="ci" class="cursor">
{{ char.toUpperCase() }}
</div>
<div v-if="chars.length === 0" class="cursor" />
</div>
</template>
<style lang="less">
.pinyin-input {
display: flex;
font-weight: bold;
font-size: 60px;
line-height: 1.2;
.cursor {
position: relative;
text-align: center;
min-height: 1.2em;
min-width: 0.5em;
&:first-child {
margin-right: 5px;
}
&::after {
position: absolute;
bottom: 0px;
left: 0px;
content: "";
width: 100%;
height: 5px;
background-color: var(--black);
margin-top: 5px;
}
&:last-child::after {
animation: alternate infinite 0.6s blink;
}
}
}
@keyframes blink {
from {
opacity: 0;
}
to {
opacity: 1;
}
}
</style>