修改终端提示.

This commit is contained in:
lijiahangmax
2025-03-08 12:44:33 +08:00
parent 6c9065072d
commit 79d9f69ed4
11 changed files with 25 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
<template>
<div class="terminal-example" ref="terminal" />
<div class="terminal-example" ref="terminalRef" />
</template>
<script lang="ts">
@@ -11,31 +11,32 @@
<script lang="ts" setup>
import type { TerminalThemeSchema } from '@/api/asset/terminal';
import { Terminal } from '@xterm/xterm';
import { onMounted, onUnmounted, ref } from 'vue';
import { markRaw, onMounted, onUnmounted, ref } from 'vue';
const props = defineProps<{
schema: TerminalThemeSchema | Record<string, any>;
}>();
const terminal = ref();
const terminalRef = ref();
const term = ref();
onMounted(() => {
term.value = new Terminal({
const terminal = new Terminal({
theme: { ...props.schema, cursor: props.schema.background },
cols: 42,
rows: 6,
fontSize: 15,
cursorInactiveStyle: 'none',
});
term.value.open(terminal.value);
term.value.write(
terminal.open(terminalRef.value);
terminal.write(
'[root@OrionServer usr]#\r\n' +
'dr-xr-xr-x. 2 root root bin\r\n' +
'dr-xr-xr-x. 2 root root sbin\r\n' +
'drwxr-xr-x. 4 root root src\r\n' +
'lrwxrwxrwx. 1 root root tmp -> ../var/tmp '
);
term.value = markRaw(terminal);
});
defineExpose({ term });

View File

@@ -363,7 +363,7 @@ export const TransferReceiver = {
};
// 会话关闭信息
export const sessionCloseMsg = 'session closed...';
export const sessionCloseMsg = '会话已结束...';
// 打开 settingModal key
export const openSettingModalKey = Symbol();