feat: add loading for live editor

This commit is contained in:
Justineo 2021-11-21 01:52:20 +08:00 committed by GU Yiling
parent 2241c6f26d
commit e9bca0efc3
2 changed files with 28 additions and 5 deletions

View File

@ -91,6 +91,7 @@ import { BrowserWindow } from 'vue-windows'
import { getLocale } from '../common/i18n' import { getLocale } from '../common/i18n'
import { play } from '../common/play' import { play } from '../common/play'
import OneEditLink from './OneEditLink' import OneEditLink from './OneEditLink'
import OneRepl from './OneRepl'
export default { export default {
name: 'one-demo', name: 'one-demo',
@ -102,7 +103,7 @@ export default {
'veui-icon': Icon, 'veui-icon': Icon,
BrowserWindow, BrowserWindow,
OneEditLink, OneEditLink,
OneRepl: () => import('./OneRepl') OneRepl
}, },
mixins: [i18n], mixins: [i18n],
props: { props: {

View File

@ -19,15 +19,28 @@
</template> </template>
<script> <script>
import { Button } from 'veui' import { Button, Loading } from 'veui'
import i18n from 'veui/mixins/i18n' import i18n from 'veui/mixins/i18n'
import OneLive from './OneLive.vue'
export default { export default {
name: 'one-repl', name: 'one-repl',
components: { components: {
'veui-button': Button, 'veui-button': Button,
'one-live': OneLive 'one-live': () => ({
component: import('./OneLive'),
loading: {
inheritAttrs: false,
render (h) {
return h(Loading, {
props: {
loading: true,
ui: 'strong'
},
class: 'loading'
})
}
}
})
}, },
mixins: [i18n], mixins: [i18n],
props: { props: {
@ -46,6 +59,7 @@ export default {
<style lang="stylus" scoped> <style lang="stylus" scoped>
.repl .repl
position relative
display flex display flex
flex-direction column flex-direction column
@ -68,7 +82,8 @@ export default {
justify-content flex-end justify-content flex-end
flex 1 1 auto flex 1 1 auto
.editor .editor:not(.loading)
position relative
flex 1 1 auto flex 1 1 auto
height calc(100vh - 48px) height calc(100vh - 48px)
@ -101,4 +116,11 @@ export default {
& >>> .VueLive-error & >>> .VueLive-error
display none display none
.loading
position absolute
top 40vh
left 50%
transform translateX(-50%)
font-size 40px
</style> </style>