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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
| <template>
| <div class="translate-box" :style="{ left: pageX + 'px', top: pageY + 'px' }">
| <div class="translate-box-word">
| <div> {{ showWord }}</div>
| <div>{{ IPA }}</div>
| </div>
| <div class="translate-box-translation">
| {{ translate }}
| </div>
| </div>
| </template>
|
| <script>
| export default {
| props: {
| showWord: {
| type: String,
| default: ""
| },
| prototype: {
| type: String,
| default: ""
| },
| IPA: {
| type: String,
| default: ""
| },
| translate: {
| type: String,
| default: ""
| },
| pageX: {
| type: Number,
| default: 0
| },
| pageY: {
| type: Number,
| default: 0
| }
| },
| name: "TranslateWord",
| }
| </script>
|
| <style lang="less" scoped>
| .translate-box {
| max-width: 20%;
| text-wrap: wrap;
| border: 2px solid #3bc6f2;
| background-color: #fff;
| position: fixed;
| z-index: 9999;
| box-sizing: border-box;
|
| .translate-box-word {
| display: flex;
| padding: 2px 5px;
| border-bottom: 1px solid #3bc6f2;
|
| div:nth-child(1) {
| color: #3bc6f2;
| padding-right: 5px;
| }
|
| div:nth-child(2) {
| overflow-wrap: break-word;
| word-break: break-word;
| /* 确保文本可以换行 */
| white-space: normal;
| }
| }
|
| .translate-box-translation {
| padding: 2px 5px;
| overflow-wrap: break-word;
| word-break: break-word;
| /* 确保文本可以换行 */
| white-space: normal;
| }
| }
| </style>
|
|