11<template >
2- <div ref =" vcv" class =" vue-repl" :style = " calcHeight " >
2+ <div ref =" vcv" class =" vue-repl" >
33 <SplitPane :layout =" flexDirection" >
44 <!-- output render -->
55 <template :slot =" outputSlot " >
66 <Output :showCompileOutput =" props.showCompileOutput" :ssr =" !!props.ssr" />
77 </template >
8-
98 <!-- code editor -->
109 <template :slot =" editorSlot " >
1110 <Editor />
@@ -23,6 +22,7 @@ import { Store, ReplStore, SFCOptions } from "./store";
2322
2423export interface Props {
2524 store? : Store ;
25+ editor? : string ;
2626 autoResize? : boolean ;
2727 showCompileOutput? : boolean ;
2828 showImportMap? : boolean ;
@@ -31,29 +31,21 @@ export interface Props {
3131 layout? : string ;
3232 ssr? : boolean ;
3333
34- // source: string;
35- // themeMode?: string; // light||dark,默认 light
36- // showCode: boolean;
37- // errorHandler?: Function;
38- // needAutoResize?: boolean;
39- // debounceDelay?: number;
40- // layout: string;
41- height? : number ;
42- minHeight? : number ;
4334}
4435
4536const props = withDefaults (defineProps <Props >(), {
4637 store : () => new ReplStore (),
38+ editor: " monaco" , // monaco || codemirror
4739 autoResize: true ,
4840 showCompileOutput: true ,
4941 showImportMap: true ,
5042 clearConsole: true ,
43+ layout: " left" ,
5144 ssr: false ,
5245
5346 // showCode: false,
5447 // debounceDelay: 300,
55- layout: " left" ,
56- minHeight: 300 ,
48+ // minHeight: 300,
5749});
5850
5951const viewLayout = computed (() =>
@@ -71,22 +63,23 @@ const editorSlot = computed(() =>
7163const outputSlot = computed (() =>
7264 viewLayout .value == " right" ? " right" : " left"
7365);
74- const calcHeight = computed (() => {
75- let heightSetting = " " ;
76- if (props .height && props .height >= 0 ) {
77- let vcvHeight =
78- props .height <= props .minHeight ? props .minHeight : props .height ;
79- heightSetting += ` height:${vcvHeight }px; ` ;
80- }
81- return heightSetting ;
82- });
66+ // const calcHeight = computed(() => {
67+ // let heightSetting = "";
68+ // if (props.height && props.height >= 0) {
69+ // let vcvHeight =
70+ // props.height <= props.minHeight ? props.minHeight : props.height;
71+ // heightSetting += ` height:${vcvHeight}px;`;
72+ // }
73+ // return heightSetting;
74+ // });
8375
8476
8577props .store .options = props .sfcOptions ;
8678props .store .init ();
8779
8880// provide(/* 注入名 */ 'message', /* 值 */ 'hello!')
8981provide (" store" , props .store );
82+ provide (" editor" , props .editor );
9083provide (" autoresize" , props .autoResize );
9184provide (" import-map" , toRef (props , " showImportMap" ));
9285provide (" clear-console" , toRef (props , " clearConsole" ));
0 commit comments