From 42b0395a354f8ccc0199194a7099ab574b3605f9 Mon Sep 17 00:00:00 2001 From: zhangyu Date: Tue, 21 Feb 2023 19:08:14 +0800 Subject: [PATCH] =?UTF-8?q?fix=EF=BC=9A=20label=20=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E5=A4=AA=E5=A4=9A=E5=AF=BC=E8=87=B4cortex=20=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nezha-fronted/src/components/cli/consoleNew.vue | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/nezha-fronted/src/components/cli/consoleNew.vue b/nezha-fronted/src/components/cli/consoleNew.vue index 7fe645cd8..47f25cdc4 100644 --- a/nezha-fronted/src/components/cli/consoleNew.vue +++ b/nezha-fronted/src/components/cli/consoleNew.vue @@ -8,7 +8,7 @@ @@ -72,8 +72,8 @@ export default { }, resizeServiceConsole () { const consoleBox = document.getElementById('ternimalContainer' + this.idIndex) - const width = document.body.clientWidth// 可视宽度 - const height = parseInt(consoleBox.offsetHeight) + const width = document.body.clientWidth - 10// 可视宽度 + const height = parseInt(consoleBox.offsetHeight) - 10 const winStyle = { width: width, height: height, @@ -100,13 +100,13 @@ export default { rows = parseInt(rows) const terminalContainer = document.getElementById('terminal' + this.idIndex) this.term = new Terminal({ - rows: rows, // 15行大概300px高,无法设置heigh,只能设置rows cursorStyle: 'block', // 光标样式 null | 'block' | 'underline' | 'bar' disableStdin: false, // 是否应禁用输入 - fontSize: this.fontSize + fontSize: 16 }) this.term.open(terminalContainer) this.term.focus() + this.term.fit() this.create() }, create () { @@ -122,10 +122,11 @@ export default { let url = '' this.terminal.height = document.body.clientHeight - 100 this.terminal.width = document.body.clientWidth + console.log(this.term.cols, this.term.cols) if (this.terminal.type === 'asset') { - url = baseUrl + '/terminal.ws?width=' + this.terminal.width + '&height=' + this.terminal.height + '&cols=' + this.terminal.cols + '&rows=' + this.terminal.rows + '&token=' + token + '&assetId=' + this.terminal.assetId + '&accountId=' + this.terminal.accountId + '&uuid=' + this.terminal.uuid + url = baseUrl + '/terminal.ws?width=' + this.terminal.width + '&height=' + this.terminal.height + '&cols=' + this.term.cols + '&rows=' + this.term.rows + '&token=' + token + '&assetId=' + this.terminal.assetId + '&accountId=' + this.terminal.accountId + '&uuid=' + this.terminal.uuid } else if (this.terminal.type === 'custom') { - url = baseUrl + '/terminal.ws?width=' + this.terminal.width + '&height=' + this.terminal.height + '&cols=' + this.terminal.cols + '&rows=' + this.terminal.rows + '&token=' + token + '&accountId=' + this.terminal.accountId + '&uuid=' + this.terminal.uuid + url = baseUrl + '/terminal.ws?width=' + this.terminal.width + '&height=' + this.terminal.height + '&cols=' + this.term.cols + '&rows=' + this.term.rows + '&token=' + token + '&accountId=' + this.terminal.accountId + '&uuid=' + this.terminal.uuid Object.keys(this.terminal.custom).forEach(key => { if (this.terminal.custom[key]) { url += '&' + key + '=' + this.terminal.custom[key] @@ -211,7 +212,7 @@ export default { this.term._initialized = true // this.term.fit()// 自适应大小(使终端的尺寸和几何尺寸适合于终端容器的尺寸) 只是width this.$nextTick(() => { // 解决进入全屏和退出全屏是底部隐藏 - this.setFontSize(this.fontSize) + // this.setFontSize(this.fontSize) }) },