Skip to content

Commit 998b145

Browse files
committed
refactor: improve loading mask in CodemirrorEditor.vue
1 parent 570ca35 commit 998b145

File tree

1 file changed

+21
-25
lines changed

1 file changed

+21
-25
lines changed

src/views/CodemirrorEditor.vue

Lines changed: 21 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,10 @@ onMounted(() => {
507507
<div class="preview">
508508
<section id="output" v-html="output" />
509509
<div v-if="isCoping" class="loading-mask">
510-
<div class="loading__img" />
511-
<span>正在生成</span>
510+
<div class="loading-mask-box">
511+
<div class="loading__img" />
512+
<span>正在生成</span>
513+
</div>
512514
</div>
513515
</div>
514516
</div>
@@ -564,32 +566,26 @@ onMounted(() => {
564566
565567
.loading-mask {
566568
position: absolute;
567-
top: 50%;
568-
left: 50%;
569-
transform: translate(-50%, -50%);
570-
width: 376px;
571-
height: 101%;
572-
padding-top: 1px;
573-
font-size: 15px;
569+
left: 0;
570+
top: 0;
571+
width: 100%;
572+
height: 100%;
573+
text-align: center;
574574
color: var(--el-text-color-regular);
575575
background-color: var(--el-bg-color);
576576
577-
.loading__img {
578-
position: absolute;
579-
left: 50%;
580-
top: 330px;
581-
width: 50px;
582-
height: 50px;
583-
transform: translate(-50%, -50%);
584-
background: url('../assets/images/favicon.png') no-repeat;
585-
background-size: cover;
586-
}
587-
588-
span {
589-
position: absolute;
590-
left: 50%;
591-
top: 390px;
592-
transform: translate(-50%, -50%);
577+
.loading-mask-box {
578+
position: sticky;
579+
top: 50%;
580+
transform: translateY(-50%);
581+
582+
.loading__img {
583+
width: 75px;
584+
height: 75px;
585+
background: url('../assets/images/favicon.png') no-repeat;
586+
margin: 1em auto;
587+
background-size: cover;
588+
}
593589
}
594590
}
595591

0 commit comments

Comments
 (0)