mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-09-23 16:35:51 +08:00
43 lines
929 B
Vue
43 lines
929 B
Vue
<template>
|
|
<div :id="config.id" :class="`magic-ui-page${config.className ? ` ${config.className}` : ''}`" :style="style">
|
|
<slot></slot>
|
|
<magic-ui-component v-for="item in config.items" :key="item.id" :config="item"></magic-ui-component>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts">
|
|
import { computed, defineComponent, PropType } from '@vue/composition-api';
|
|
|
|
import { MPage } from '@tmagic/schema';
|
|
|
|
import Component from '../Component.vue';
|
|
import useApp from '../useApp';
|
|
|
|
export default defineComponent({
|
|
name: 'magic-ui-page',
|
|
|
|
components: {
|
|
'magic-ui-component': Component,
|
|
},
|
|
|
|
props: {
|
|
config: {
|
|
type: Object as PropType<MPage>,
|
|
default: () => ({}),
|
|
},
|
|
},
|
|
|
|
setup(props) {
|
|
const app = useApp(props);
|
|
|
|
return {
|
|
style: computed(() => app?.transformStyle(props.config.style || {})),
|
|
|
|
refresh() {
|
|
window.location.reload();
|
|
},
|
|
};
|
|
},
|
|
});
|
|
</script>
|