因此,我正在尝试创建一个嵌入了终端的网站,并使用 xterm 来执行此操作。到目前为止,我一直在学习 xterm 并试图让基础知识发挥作用,但我一直遇到困难。下面是终端的代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Mohammad Nadeem</title>
<link rel="stylesheet" href="node_modules/xterm/dist/xterm.css" />
<script src="node_modules/xterm/dist/xterm.js"></script>
</head>
<body>
<div id = "terminal">
</div>
<script type = "text/javascript">
import { Terminal } from 'xterm';
var term = new Terminal();
term.open(document.getElementById('terminal'), true);
term.fit();
term.writeln('Hello World!');
</script>
</html>