fix(playground): pc预览适配

This commit is contained in:
roymondchen 2022-08-11 17:50:15 +08:00 committed by jia000
parent 0e82f652a9
commit 31d60eb1ba
3 changed files with 15 additions and 5 deletions

View File

@ -39,7 +39,8 @@ export default defineComponent({
modelValue: {
type: Object,
default: () => ({
width: '375',
width: 375,
height: 817,
}),
},
},

View File

@ -33,7 +33,7 @@ export default {
top: 0,
right: '',
bottom: '',
width: '375',
width: '100%',
height: '1728',
backgroundImage: '',
backgroundColor: 'rgba(248, 218, 218, 1)',

View File

@ -19,8 +19,14 @@
</template>
</m-editor>
<el-dialog v-model="previewVisible" destroy-on-close :width="375" custom-class="pre-viewer" title="预览">
<iframe v-if="previewVisible" width="100%" height="817" :src="previewUrl"></iframe>
<el-dialog
v-model="previewVisible"
destroy-on-close
custom-class="pre-viewer"
title="预览"
:width="stageRect && stageRect.width"
>
<iframe v-if="previewVisible" width="100%" :height="stageRect && stageRect.height" :src="previewUrl"></iframe>
</el-dialog>
</div>
</template>
@ -53,7 +59,10 @@ const defaultSelected = ref(dsl.items[0].id);
const propsValues = ref<Record<string, any>>({});
const propsConfigs = ref<Record<string, any>>({});
const eventMethodList = ref<Record<string, any>>({});
const stageRect = ref();
const stageRect = ref({
width: 375,
height: 817,
});
const previewUrl = computed(
() => `${VITE_RUNTIME_PATH}/page/index.html?localPreview=1&page=${editor.value?.editorService.get('page').id}`,