⚡ 修改终端提示.
This commit is contained in:
@@ -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(
|
||||
'[1;94m[root[0m@[1;96mOrionServer usr]#[0m\r\n' +
|
||||
'dr-xr-xr-x. 2 root root [0m[01;34mbin[0m\r\n' +
|
||||
'dr-xr-xr-x. 2 root root [01;34msbin[0m\r\n' +
|
||||
'drwxr-xr-x. 4 root root [01;34msrc[0m\r\n' +
|
||||
'lrwxrwxrwx. 1 root root [01;36mtmp[0m -> [30;42m../var/tmp[0m '
|
||||
);
|
||||
term.value = markRaw(terminal);
|
||||
});
|
||||
|
||||
defineExpose({ term });
|
||||
|
||||
@@ -363,7 +363,7 @@ export const TransferReceiver = {
|
||||
};
|
||||
|
||||
// 会话关闭信息
|
||||
export const sessionCloseMsg = 'session closed...';
|
||||
export const sessionCloseMsg = '会话已结束...';
|
||||
|
||||
// 打开 settingModal key
|
||||
export const openSettingModalKey = Symbol();
|
||||
|
||||
Reference in New Issue
Block a user