This commit is contained in:
@@ -26,10 +26,13 @@ const formattedVariables = computed(() => {
|
|||||||
// 处理特殊类型
|
// 处理特殊类型
|
||||||
let displayValue = ""
|
let displayValue = ""
|
||||||
let displayType = typeof value
|
let displayType = typeof value
|
||||||
|
|
||||||
if (Array.isArray(value) && value.length === 2 &&
|
if (
|
||||||
value[0] === "IMPORTED_FAUX_PRIMITIVE" &&
|
Array.isArray(value) &&
|
||||||
value[1] === "imported object") {
|
value.length === 2 &&
|
||||||
|
value[0] === "IMPORTED_FAUX_PRIMITIVE" &&
|
||||||
|
value[1] === "imported object"
|
||||||
|
) {
|
||||||
displayValue = ""
|
displayValue = ""
|
||||||
displayType = "function"
|
displayType = "function"
|
||||||
} else if (typeof value === "object" && value !== null) {
|
} else if (typeof value === "object" && value !== null) {
|
||||||
@@ -84,74 +87,67 @@ function closePanel() {
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<n-space vertical :size="16" class="panel-content">
|
<n-space vertical :size="16" class="panel-content">
|
||||||
<!-- 变量部分 -->
|
<!-- 变量部分 -->
|
||||||
<n-collapse :default-expanded-names="['variables']">
|
<n-collapse :default-expanded-names="['variables']">
|
||||||
<n-collapse-item title="变量" name="variables">
|
<n-collapse-item title="变量" name="variables">
|
||||||
<template #header>
|
<template #header>
|
||||||
<n-flex align="center" :gap="8">
|
<n-flex align="center" :gap="8">
|
||||||
<n-icon>
|
<n-icon>
|
||||||
<Icon icon="mdi:variable" :width="14" :height="14" />
|
<Icon icon="mdi:variable" :width="14" :height="14" />
|
||||||
</n-icon>
|
</n-icon>
|
||||||
<n-text>变量</n-text>
|
<n-text>变量</n-text>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<div v-if="formattedVariables.length === 0">
|
<div v-if="formattedVariables.length === 0">
|
||||||
<n-text
|
<n-text type="info" class="no-variables-text"> 暂无变量 </n-text>
|
||||||
type="info"
|
</div>
|
||||||
class="no-variables-text"
|
<n-space v-else vertical :size="12">
|
||||||
|
<n-card
|
||||||
|
v-for="variable in formattedVariables"
|
||||||
|
:key="variable.name"
|
||||||
|
size="small"
|
||||||
|
:bordered="true"
|
||||||
|
>
|
||||||
|
<n-flex
|
||||||
|
justify="space-between"
|
||||||
|
align="center"
|
||||||
|
class="variable-header"
|
||||||
>
|
>
|
||||||
暂无变量
|
<n-text strong :type="'primary'">{{ variable.name }}</n-text>
|
||||||
</n-text>
|
<n-tag size="small" type="info">{{ variable.type }}</n-tag>
|
||||||
</div>
|
</n-flex>
|
||||||
<n-space v-else vertical :size="12">
|
<n-scrollbar style="max-height: 200px">
|
||||||
<n-card
|
<n-text code class="variable-value">
|
||||||
v-for="variable in formattedVariables"
|
|
||||||
:key="variable.name"
|
|
||||||
size="small"
|
|
||||||
:bordered="true"
|
|
||||||
>
|
|
||||||
<n-flex
|
|
||||||
justify="space-between"
|
|
||||||
align="center"
|
|
||||||
class="variable-header"
|
|
||||||
>
|
|
||||||
<n-text strong :type="'primary'">{{ variable.name }}</n-text>
|
|
||||||
<n-tag size="small" type="info">{{ variable.type }}</n-tag>
|
|
||||||
</n-flex>
|
|
||||||
<n-text
|
|
||||||
code
|
|
||||||
class="variable-value"
|
|
||||||
>
|
|
||||||
{{ variable.value }}
|
{{ variable.value }}
|
||||||
</n-text>
|
</n-text>
|
||||||
</n-card>
|
</n-scrollbar>
|
||||||
</n-space>
|
</n-card>
|
||||||
</n-collapse-item>
|
</n-space>
|
||||||
</n-collapse>
|
</n-collapse-item>
|
||||||
|
</n-collapse>
|
||||||
|
|
||||||
<!-- 输出部分 -->
|
<!-- 输出部分 -->
|
||||||
<n-collapse v-if="formattedOutput" :default-expanded-names="['output']">
|
<n-collapse v-if="formattedOutput" :default-expanded-names="['output']">
|
||||||
<n-collapse-item :title="`输出 (${outputLines} 行)`" name="output">
|
<n-collapse-item :title="`输出 (${outputLines} 行)`" name="output">
|
||||||
<template #header>
|
<template #header>
|
||||||
<n-flex align="center">
|
<n-flex align="center">
|
||||||
<n-icon>
|
<n-icon>
|
||||||
<Icon icon="mdi:console" :width="14" :height="14" />
|
<Icon icon="mdi:console" :width="14" :height="14" />
|
||||||
</n-icon>
|
</n-icon>
|
||||||
<n-text>输出 ({{ outputLines }} 行)</n-text>
|
<n-text>输出({{ outputLines }}行)</n-text>
|
||||||
</n-flex>
|
</n-flex>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<n-card size="small" :bordered="true">
|
<n-card size="small" :bordered="true">
|
||||||
<n-text
|
<n-scrollbar style="max-height: 400px">
|
||||||
code
|
<n-text code class="output-text">
|
||||||
class="output-text"
|
|
||||||
>
|
|
||||||
{{ formattedOutput }}
|
{{ formattedOutput }}
|
||||||
</n-text>
|
</n-text>
|
||||||
</n-card>
|
</n-scrollbar>
|
||||||
</n-collapse-item>
|
</n-card>
|
||||||
</n-collapse>
|
</n-collapse-item>
|
||||||
|
</n-collapse>
|
||||||
</n-space>
|
</n-space>
|
||||||
</n-card>
|
</n-card>
|
||||||
</template>
|
</template>
|
||||||
@@ -170,8 +166,6 @@ function closePanel() {
|
|||||||
font-size: 12px;
|
font-size: 12px;
|
||||||
white-space: pre-wrap;
|
white-space: pre-wrap;
|
||||||
word-break: break-all;
|
word-break: break-all;
|
||||||
max-height: 400px;
|
|
||||||
overflow-y: auto;
|
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -10,7 +10,7 @@ import { useIntervalFn } from "@vueuse/core"
|
|||||||
|
|
||||||
// 组件
|
// 组件
|
||||||
import DebugEditor from "../components/DebugEditor.vue"
|
import DebugEditor from "../components/DebugEditor.vue"
|
||||||
import FloatingPanel from "../components/FloatingPanel.vue"
|
import DebugPanel from "../components/DebugPanel.vue"
|
||||||
|
|
||||||
// 组合式函数和类型
|
// 组合式函数和类型
|
||||||
import { code, input, reset, size, output, status } from "../composables/code"
|
import { code, input, reset, size, output, status } from "../composables/code"
|
||||||
@@ -492,8 +492,8 @@ function autoRun() {
|
|||||||
:next-line-text="nextLineText"
|
:next-line-text="nextLineText"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<!-- 浮动调试面板 -->
|
<!-- 调试面板 -->
|
||||||
<FloatingPanel
|
<DebugPanel
|
||||||
:visible="showFloatingPanel"
|
:visible="showFloatingPanel"
|
||||||
:variables="currentVariables"
|
:variables="currentVariables"
|
||||||
:output="currentOutput"
|
:output="currentOutput"
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ import {
|
|||||||
NText,
|
NText,
|
||||||
NTooltip,
|
NTooltip,
|
||||||
NSlider,
|
NSlider,
|
||||||
|
NScrollbar,
|
||||||
create,
|
create,
|
||||||
} from "naive-ui"
|
} from "naive-ui"
|
||||||
import "normalize.css"
|
import "normalize.css"
|
||||||
@@ -61,6 +62,7 @@ const naive = create({
|
|||||||
NText,
|
NText,
|
||||||
NTooltip,
|
NTooltip,
|
||||||
NSlider,
|
NSlider,
|
||||||
|
NScrollbar,
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user