You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.0 KiB
49 lines
1.0 KiB
4 years ago
|
<template>
|
||
|
<!-- <router-view #="{ Component }">-->
|
||
|
<!-- <component :is="Component" />-->
|
||
|
<!-- </router-view>-->
|
||
|
<visual-editor
|
||
|
v-model="jsonData"
|
||
|
:config="visualConfig"
|
||
|
:form-data="formData"
|
||
|
:custom-props="customProps"
|
||
|
/>
|
||
|
</template>
|
||
|
|
||
|
<script lang="ts">
|
||
|
import { defineComponent, reactive, toRefs } from 'vue'
|
||
|
import VisualEditor from '@/visual-editor/index.vue'
|
||
|
import { visualConfig } from './visual.config'
|
||
|
|
||
|
export default defineComponent({
|
||
|
name: 'App',
|
||
|
components: { VisualEditor },
|
||
|
setup() {
|
||
|
const state = reactive({
|
||
|
jsonData: {
|
||
|
container: {
|
||
|
height: 500,
|
||
|
width: 800
|
||
|
},
|
||
|
blocks: JSON.parse(sessionStorage.getItem('blocks') || '[]')
|
||
|
},
|
||
|
formData: [],
|
||
|
customProps: {}
|
||
|
})
|
||
|
|
||
|
window.addEventListener('beforeunload', () => {
|
||
|
sessionStorage.setItem('blocks', JSON.stringify(state.jsonData.blocks))
|
||
|
})
|
||
|
|
||
|
return {
|
||
|
...toRefs(state),
|
||
|
visualConfig
|
||
|
}
|
||
|
}
|
||
|
})
|
||
|
</script>
|
||
|
|
||
|
<style lang="scss">
|
||
|
@import 'style/common';
|
||
|
</style>
|