perf: separation of components (#185)

分离自定义 CSS 部分
This commit is contained in:
YangQi 2022-08-16 21:20:20 +08:00 committed by GitHub
parent d5fdd04be9
commit 99c0ce6a56
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 67 additions and 56 deletions

View File

@ -0,0 +1,64 @@
<template>
<transition enter-active-class="bounceInRight">
<el-col :span="12" v-show="showCssEditor" class="cssEditor-wrapper">
<textarea
id="cssEditor"
type="textarea"
placeholder="Your custom css here."
>
</textarea>
</el-col>
</transition>
</template>
<script>
export default {
name: `CssEditor`,
props: {
showCssEditor: {
type: Boolean,
default: false,
},
},
}
</script>
<style lang="less" scoped>
.bounceInRight {
animation-name: bounceInRight;
animation-duration: 1s;
animation-fill-mode: both;
}
@keyframes bounceInRight {
0%,
60%,
75%,
90%,
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;
}
}
</style>

View File

@ -63,24 +63,7 @@
</div> </div>
</section> </section>
</el-col> </el-col>
<transition <css-editor :show-css-editor="showCssEditor"></css-editor>
name="custom-classes-transition"
enter-active-class="bounceInRight"
>
<el-col
id="cssBox"
v-show="showCssEditor"
:span="12"
class="cssEditor-wrapper"
>
<textarea
id="cssEditor"
type="textarea"
placeholder="Your custom css here."
>
</textarea>
</el-col>
</transition>
</el-row> </el-row>
</el-main> </el-main>
</el-container> </el-container>
@ -111,6 +94,7 @@ import AboutDialog from '@/components/CodemirrorEditor/AboutDialog'
import InsertFormDialog from '@/components/CodemirrorEditor/InsertFormDialog' import InsertFormDialog from '@/components/CodemirrorEditor/InsertFormDialog'
import RightClickMenu from '@/components/CodemirrorEditor/RightClickMenu' import RightClickMenu from '@/components/CodemirrorEditor/RightClickMenu'
import UploadImgDialog from '@/components/CodemirrorEditor/UploadImgDialog' import UploadImgDialog from '@/components/CodemirrorEditor/UploadImgDialog'
import CssEditor from '@/components/CodemirrorEditor/CssEditor'
import RunLoading from '@/components/RunLoading' import RunLoading from '@/components/RunLoading'
import { import {
@ -148,6 +132,7 @@ export default {
} }
}, },
components: { components: {
CssEditor,
RunLoading, RunLoading,
EditorHeader, EditorHeader,
AboutDialog, AboutDialog,
@ -698,48 +683,10 @@ export default {
} }
} }
.bounceInRight {
animation-name: bounceInRight;
animation-duration: 1s;
animation-fill-mode: both;
}
/deep/ .preview-table { /deep/ .preview-table {
border-spacing: 0; border-spacing: 0;
} }
@keyframes bounceInRight {
0%,
60%,
75%,
90%,
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;
}
}
.codeMirror-wrapper { .codeMirror-wrapper {
overflow-x: auto; overflow-x: auto;
} }