fix: the lost animation (#175)

- 恢复移除的 css 代码,并将其并入 `<Loading>` 组件当中
- 动画控制迁移至 `<Loading>`
This commit is contained in:
YangQi 2022-08-08 17:30:41 +08:00 committed by GitHub
parent dd4fe6f3cf
commit 7ea21044b0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 65 additions and 39 deletions

View File

@ -1,23 +1,32 @@
<template>
<div class="loading" id="loading">
<transition name="fade" v-if="loading">
<div class="loading">
<div class="loading-wrapper">
<div class="loading-anim"></div>
<div class="loading-text">致力于让 Markdown 编辑更简单</div>
</div>
</div>
</transition>
</template>
<script></script>
<script>
export default {
name: `Loading`,
data() {
return {
loading: true,
}
},
mounted() {
setTimeout(() => {
this.loading = false
}, 100)
},
}
</script>
<style lang="less" scoped>
.loading-wrapper {
position: fixed;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
}
.loading {
text-align: center;
position: fixed;
width: 100%;
height: 100%;
@ -30,11 +39,12 @@
background-color: #303133;
}
.loading-text {
font-size: 18px;
font-weight: bold;
margin-top: 26px;
color: #303133;
.loading-wrapper {
position: absolute;
top: 50%;
left: 50%;
transform: translateX(-50%) translateY(-50%);
text-align: center;
}
.loading-anim {
@ -44,4 +54,26 @@
background: url('../assets/images/favicon.png') no-repeat;
background-size: cover;
}
.loading-text {
font-size: 18px;
font-weight: bold;
margin-top: 26px;
color: #303133;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
.fade-enter-to,
.fade-leave {
opacity: 1;
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 1s;
}
</style>

View File

@ -100,14 +100,16 @@
@menuTick="onMenuEvent"
@closeMenu="closeRightClickMenu"
/>
<loading></loading>
</div>
</template>
<script>
import editorHeader from '../components/CodemirrorEditor/header'
import aboutDialog from '../components/CodemirrorEditor/aboutDialog'
import insertFormDialog from '../components/CodemirrorEditor/insertForm'
import rightClickMenu from '../components/CodemirrorEditor/rightClickMenu'
import uploadImgDialog from '../components/CodemirrorEditor/uploadImgDialog'
import editorHeader from '@/components/CodemirrorEditor/header'
import aboutDialog from '@/components/CodemirrorEditor/aboutDialog'
import insertFormDialog from '@/components/CodemirrorEditor/insertForm'
import rightClickMenu from '@/components/CodemirrorEditor/rightClickMenu'
import uploadImgDialog from '@/components/CodemirrorEditor/uploadImgDialog'
import Loading from '@/components/Loading'
import {
css2json,
@ -143,6 +145,7 @@ export default {
}
},
components: {
Loading,
editorHeader,
aboutDialog,
insertFormDialog,
@ -710,20 +713,25 @@ export default {
100% {
transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);
}
0% {
opacity: 0;
transform: translate3d(3000px, 0, 0);
}
60% {
opacity: 1;
transform: translate3d(-25px, 0, 0);
}
75% {
transform: translate3d(10px, 0, 0);
}
90% {
transform: translate3d(-5px, 0, 0);
}
100% {
transform: none;
}
@ -733,6 +741,7 @@ export default {
overflow-x: auto;
}
</style>
<style lang="less" scoped>
@import url('../assets/less/app.less');
</style>

View File

@ -1,30 +1,15 @@
<template>
<transition name="fade" v-if="loading">
<loading />
</transition>
<codemirror-editor v-else />
<codemirror-editor />
</template>
<script>
import Loading from '../components/Loading'
import CodemirrorEditor from './CodemirrorEditor'
export default {
name: `App`,
components: {
Loading,
CodemirrorEditor,
},
data() {
return {
loading: true,
}
},
mounted() {
setTimeout(() => {
this.loading = false
}, 100)
},
}
</script>