赞
踩
import {Terminal} from "xterm";
import {FitAddon} from "xterm-addon-fit";
import "xterm/css/xterm.css";
<div id="terminal"></div>
onMounted(() => { nextTick(() => { initTerm(); }) }) const initTerm = async () => { let termContainer = document.getElementById("terminal"); term = new Terminal({ lineHeight: 1.3, fontSize: 15, fontFamily: "WenQuanYi Micro Hei, Monaco, Menlo, Consolas, 'Courier New', monospace", theme: { background: '#181d28', }, unicodeVersion: 12, convertEol: true, // 光标闪烁 cursorBlink: true, cursorStyle: 'underline', scrollback: 100, tabStopWidth: 4, }); term.open(termContainer) };
命令 | 含义 |
---|---|
term.write(‘\n’) | 换行 |
term.write(‘\r’+内容) | 从头替换当前行内容 |
write(‘\x1b[2K\r’) | 删除当前整行 |
term._core.buffer.x = 0;
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。