fix: label 数量太多导致cortex 异常
This commit is contained in:
@@ -8,7 +8,7 @@
|
|||||||
</style>
|
</style>
|
||||||
<template>
|
<template>
|
||||||
<div :id="'ternimalContainer'+idIndex" class="console">
|
<div :id="'ternimalContainer'+idIndex" class="console">
|
||||||
<div :id="'terminal'+idIndex" style="height: 100%"></div>
|
<div :id="'terminal'+idIndex" style="height: 100%;width: 100%"></div>
|
||||||
<fileDirectory :host="host" v-clickoutside="closeFileDir" :uuid="terminal.uuid" v-show="fileDirectoryShow" @close="showFileDir(false)" :fileDirectoryShow="fileDirectoryShow" ref="fileDirectory"/>
|
<fileDirectory :host="host" v-clickoutside="closeFileDir" :uuid="terminal.uuid" v-show="fileDirectoryShow" @close="showFileDir(false)" :fileDirectoryShow="fileDirectoryShow" ref="fileDirectory"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -72,8 +72,8 @@ export default {
|
|||||||
},
|
},
|
||||||
resizeServiceConsole () {
|
resizeServiceConsole () {
|
||||||
const consoleBox = document.getElementById('ternimalContainer' + this.idIndex)
|
const consoleBox = document.getElementById('ternimalContainer' + this.idIndex)
|
||||||
const width = document.body.clientWidth// 可视宽度
|
const width = document.body.clientWidth - 10// 可视宽度
|
||||||
const height = parseInt(consoleBox.offsetHeight)
|
const height = parseInt(consoleBox.offsetHeight) - 10
|
||||||
const winStyle = {
|
const winStyle = {
|
||||||
width: width,
|
width: width,
|
||||||
height: height,
|
height: height,
|
||||||
@@ -100,13 +100,13 @@ export default {
|
|||||||
rows = parseInt(rows)
|
rows = parseInt(rows)
|
||||||
const terminalContainer = document.getElementById('terminal' + this.idIndex)
|
const terminalContainer = document.getElementById('terminal' + this.idIndex)
|
||||||
this.term = new Terminal({
|
this.term = new Terminal({
|
||||||
rows: rows, // 15行大概300px高,无法设置heigh,只能设置rows
|
|
||||||
cursorStyle: 'block', // 光标样式 null | 'block' | 'underline' | 'bar'
|
cursorStyle: 'block', // 光标样式 null | 'block' | 'underline' | 'bar'
|
||||||
disableStdin: false, // 是否应禁用输入
|
disableStdin: false, // 是否应禁用输入
|
||||||
fontSize: this.fontSize
|
fontSize: 16
|
||||||
})
|
})
|
||||||
this.term.open(terminalContainer)
|
this.term.open(terminalContainer)
|
||||||
this.term.focus()
|
this.term.focus()
|
||||||
|
this.term.fit()
|
||||||
this.create()
|
this.create()
|
||||||
},
|
},
|
||||||
create () {
|
create () {
|
||||||
@@ -122,10 +122,11 @@ export default {
|
|||||||
let url = ''
|
let url = ''
|
||||||
this.terminal.height = document.body.clientHeight - 100
|
this.terminal.height = document.body.clientHeight - 100
|
||||||
this.terminal.width = document.body.clientWidth
|
this.terminal.width = document.body.clientWidth
|
||||||
|
console.log(this.term.cols, this.term.cols)
|
||||||
if (this.terminal.type === 'asset') {
|
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') {
|
} 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 => {
|
Object.keys(this.terminal.custom).forEach(key => {
|
||||||
if (this.terminal.custom[key]) {
|
if (this.terminal.custom[key]) {
|
||||||
url += '&' + key + '=' + this.terminal.custom[key]
|
url += '&' + key + '=' + this.terminal.custom[key]
|
||||||
@@ -211,7 +212,7 @@ export default {
|
|||||||
this.term._initialized = true
|
this.term._initialized = true
|
||||||
// this.term.fit()// 自适应大小(使终端的尺寸和几何尺寸适合于终端容器的尺寸) 只是width
|
// this.term.fit()// 自适应大小(使终端的尺寸和几何尺寸适合于终端容器的尺寸) 只是width
|
||||||
this.$nextTick(() => { // 解决进入全屏和退出全屏是底部隐藏
|
this.$nextTick(() => { // 解决进入全屏和退出全屏是底部隐藏
|
||||||
this.setFontSize(this.fontSize)
|
// this.setFontSize(this.fontSize)
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user