vue + xterm 前端终端terminal
terminal
The new Windows Terminal and the original Windows console host, all in the same place!
项目地址:https://gitcode.com/gh_mirrors/term/terminal
免费下载资源
·
引入
import {Terminal} from "xterm";
import {FitAddon} from "xterm-addon-fit";
import "xterm/css/xterm.css";
html
<div id="terminal"></div>
vue
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)
};
write
命令 | 含义 |
---|---|
term.write(‘\n’) | 换行 |
term.write(‘\r’+内容) | 从头替换当前行内容 |
write(‘\x1b[2K\r’) | 删除当前整行 |
调整光标位置
term._core.buffer.x = 0;
GitHub 加速计划 / term / terminal
94.53 K
8.17 K
下载
The new Windows Terminal and the original Windows console host, all in the same place!
最近提交(Master分支:2 个月前 )
d04381ec
"HighContrast" is not a possible requested theme. So `_UpdateBackgroundForMica()` would force the settings UI to be light or dark. To fix this, we just check if we're in high contrast mode and, if so, we don't bother setting the requested theme. 5 天前
e83434ff
Turns out that having the styles for the KeyChordText and ParsedCommandLineText be empty for high contrast mode caused the issue. Since we're already using theme resources for the colors, we automatically adjust properly to whatever the high contrast theme is (Thanks XAML!).
Bonus points:
- we didn't need the theme dictionaries anymore, so I just moved them to the ResourceDictionary directly
- ParsedCommandLineTextBlockStyle isn't used. So I removed it altogether.
Validated command palette with multiple high contrast themes. See PR thread for demo.
Closes #17914 5 天前
更多推荐
已为社区贡献8条内容
所有评论(0)