From e1f9bf7f716f91154d21cb7d46338b0807d4deb6 Mon Sep 17 00:00:00 2001 From: nemo shen Date: Mon, 1 Jan 2024 15:29:15 +0800 Subject: [PATCH] feat: console --- components.d.ts | 2 ++ package.json | 2 +- src/App.vue | 38 ++++++++++++++++++++++++++----- src/components/Console.vue | 38 +++++++++++++++++++++++++++++++ src/components/Message.vue | 39 ++++++++++++++++++++++++++++++++ src/components/VersionSelect.vue | 1 - src/store.ts | 4 ++-- 7 files changed, 114 insertions(+), 10 deletions(-) create mode 100644 src/components/Console.vue create mode 100644 src/components/Message.vue diff --git a/components.d.ts b/components.d.ts index b016dc2..98cc9cd 100644 --- a/components.d.ts +++ b/components.d.ts @@ -7,7 +7,9 @@ export {} declare module 'vue' { export interface GlobalComponents { + Console: (typeof import('./src/components/Console.vue'))['default']; Header: (typeof import('./src/components/Header.vue'))['default']; + Message: (typeof import('./src/components/Message.vue'))['default']; VanIcon: (typeof import('vant/es'))['Icon']; VersionSelect: (typeof import('./src/components/VersionSelect.vue'))['default']; } diff --git a/package.json b/package.json index 2978ccd..4722186 100644 --- a/package.json +++ b/package.json @@ -14,13 +14,13 @@ "format": "prettier -w --cache \"**/*.[tj]s?(x)\"" }, "dependencies": { + "@types/splitpanes": "^2.2.6", "@unocss/reset": "^0.58.0", "@vant/icons": "^3.0.2", "@vue/repl": "^3.0.0", "@vueuse/core": "^10.7.0", "fflate": "^0.8.1", "semver": "^7.5.4", - "@types/splitpanes": "^2.2.6", "splitpanes": "^3.1.5", "vant": "^4.8.1", "vue": "^3.3.11" diff --git a/src/App.vue b/src/App.vue index 360bfb0..4bbbd02 100644 --- a/src/App.vue +++ b/src/App.vue @@ -2,6 +2,7 @@ import { Repl, Preview, type SFCOptions } from '@vue/repl'; import Monaco from '@vue/repl/monaco-editor'; import Header from './components/Header.vue'; +import Console from './components/Console.vue'; import { ref, provide, watchEffect, computed } from 'vue'; import { useDark } from '@vueuse/core'; import { Splitpanes, Pane } from 'splitpanes'; @@ -48,22 +49,43 @@ function reload() { defineExpose({ reload }); watchEffect(() => history.replaceState({}, '', store.serialize())); -const panelSize = ref(20) +const panelSize = ref(25); const onResizePanel = (event: { size: number }[]) => { - panelSize.value = event[0].size -} + panelSize.value = event[0].size; +}; +const panelConfig = computed(() => { + return { + output: { + size: panelSize.value, + minSize: 20, + }, + editor: { + size: 100 - 20 - panelSize.value, + minSize: 20, + }, + console: { + size: 40, + }, + }; +}); @@ -111,7 +136,8 @@ body { .right { flex: 1; } - .left, .toggler { + .left, + .toggler { display: none; } } diff --git a/src/components/Console.vue b/src/components/Console.vue new file mode 100644 index 0000000..b123ee4 --- /dev/null +++ b/src/components/Console.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/src/components/Message.vue b/src/components/Message.vue new file mode 100644 index 0000000..c82d36b --- /dev/null +++ b/src/components/Message.vue @@ -0,0 +1,39 @@ + + + + diff --git a/src/components/VersionSelect.vue b/src/components/VersionSelect.vue index 86d457f..4f9a88f 100644 --- a/src/components/VersionSelect.vue +++ b/src/components/VersionSelect.vue @@ -2,7 +2,6 @@ import { ref, defineProps, - defineEmits, type Ref, } from "vue"; const emit = defineEmits(["update:modelValue"]); diff --git a/src/store.ts b/src/store.ts index c82e8ba..deb637c 100644 --- a/src/store.ts +++ b/src/store.ts @@ -74,8 +74,8 @@ const _files = { [TSCONFIG]: tsconfigCode, }; -const userFiles = location.hash.slice(1); -// const userFiles = ""; +// const userFiles = location.hash.slice(1); +const userFiles = ''; class VantReplStore extends ReplStore { constructor(storeOptions: StoreOptions = {}) {