xterm.js如何应用全屏插件?

时间:2018-07-20 12:43:15

标签: xtermjs

我在html文件中使用了xterm.js,通过src导入xterm.js:

<head>
  <link rel="stylesheet" href="/static/plugins/xterm/dist/xterm.css" />
  <link rel="stylesheet" href="/static/plugins/xterm/dist/addons/fullscreen/fullscreen.css" />
  <script src="/static/plugins/xterm/dist/xterm.js"></script>
  <script src="/static/plugins/xterm/dist/addons/fullscreen/fullscreen.js"></script>
</head>

  <script>
     var term = new Terminal();
     term.open(element);
  </script>

如何应用全屏插件?我引用了官方链接: https://xtermjs.org/docs/api/addons/fullscreen/ 但对我不起作用!

1 个答案:

答案 0 :(得分:2)

您必须在Terminal.applyAddon(fullscreen);前面添加var term = new Terminal();