fix: fix the bug

parent c9bd6af8
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
"../node_modules/jquery-sparkline/jquery.sparkline.js", "../node_modules/jquery-sparkline/jquery.sparkline.js",
"../node_modules/tether/dist/js/tether.min.js", "../node_modules/tether/dist/js/tether.min.js",
"../node_modules/bootstrap/dist/js/bootstrap.min.js", "../node_modules/bootstrap/dist/js/bootstrap.min.js",
"../node_modules/xterm/dist/xterm.js", "../node_modules/term.js/src/term.js",
"../node_modules/layui-layer/dist/layer.js", "../node_modules/layui-layer/dist/layer.js",
"../node_modules/socket.io-client/dist/socket.io.js", "../node_modules/socket.io-client/dist/socket.io.js",
"./assets/js/mstsc.js", "./assets/js/mstsc.js",
......
import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core'; import {AfterViewInit, Component, OnInit, ViewChild} from '@angular/core';
import {ElementRef, Renderer2} from '@angular/core'; import {ElementRef} from '@angular/core';
import {term} from '../../globals'; import {term} from '../../globals';
import {Terminal} from '../../globals'; import {Terminal} from '../../globals';
import * as jQuery from 'jquery/dist/jquery.min.js';
@Component({ @Component({
selector: 'app-element-term', selector: 'app-element-term',
...@@ -12,7 +13,7 @@ export class ElementTermComponent implements OnInit, AfterViewInit { ...@@ -12,7 +13,7 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
@ViewChild('term') el: ElementRef; @ViewChild('term') el: ElementRef;
constructor(private rd: Renderer2) { constructor() {
} }
ngOnInit() { ngOnInit() {
...@@ -20,30 +21,29 @@ export class ElementTermComponent implements OnInit, AfterViewInit { ...@@ -20,30 +21,29 @@ export class ElementTermComponent implements OnInit, AfterViewInit {
} }
ngAfterViewInit() { ngAfterViewInit() {
// term.col = Math.floor(jQuery(this.el.nativeElement).width() / jQuery('#liuzheng').width() * 8) - 3; term.col = Math.floor(jQuery(this.el.nativeElement).width() / jQuery('#liuzheng').width() * 8) - 3;
// term.row = Math.floor(jQuery(this.el.nativeElement).height() / jQuery('#liuzheng').height()) - 5; term.row = Math.floor(jQuery(this.el.nativeElement).height() / jQuery('#liuzheng').height()) - 5;
term.col = 90; console.log(term);
term.row = 90; // term.term = Terminal({
term.term = Terminal({ // cols: term.col,
cols: term.col, // rows: term.row,
rows: term.row, // useStyle: true,
useStyle: true, // screenKeys: true,
screenKeys: true, // });
});
term.term.open(this.el.nativeElement, true); term.term.open(this.el.nativeElement, true);
// const that = this; const that = this;
// window.onresize = function () { window.onresize = function () {
// term.col = Math.floor(jQuery(that.el.nativeElement).width() / jQuery('#liuzheng').width() * 8) - 3; term.col = Math.floor(jQuery(that.el.nativeElement).width() / jQuery('#liuzheng').width() * 8) - 3;
// term.row = Math.floor(jQuery(that.el.nativeElement).height() / jQuery('#liuzheng').height()) - 5; term.row = Math.floor(jQuery(that.el.nativeElement).height() / jQuery('#liuzheng').height()) - 5;
//
// if (term.col < 80) { if (term.col < 80) {
// term.col = 80; term.col = 80;
// } }
// if (term.row < 24) { if (term.row < 24) {
// term.row = 24; term.row = 24;
// } }
// term.term.resize(term.col, term.row); term.term.resize(term.col, term.row);
// }; };
} }
} }
...@@ -11,7 +11,12 @@ export let term: { ...@@ -11,7 +11,12 @@ export let term: {
col: number; col: number;
row: number; row: number;
} = { } = {
term: Terminal({}), term: Terminal({
cols: 80,
rows: 24,
useStyle: true,
screenKeys: true,
}),
col: 80, col: 80,
row: 24, row: 24,
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment