diff --git a/nezha-fronted/src/components/cli/console.vue b/nezha-fronted/src/components/cli/console.vue index eedda39b5..ddf9d4bc4 100644 --- a/nezha-fronted/src/components/cli/console.vue +++ b/nezha-fronted/src/components/cli/console.vue @@ -25,6 +25,7 @@ export default { type: Boolean, default: false, }, + fontSize:{} }, data () { return { @@ -35,7 +36,6 @@ export default { topMenuHeight:30, dragHeigh:8, minRow:1, - fontSize:15, fontSpaceHeight:2,//一行高度=fontSize+fontSpaceHeight obj:{ id:2 @@ -314,7 +314,6 @@ export default { }, setFontSize(fontSize){ this.term.setOption('fontSize',fontSize); - this.fontSize=fontSize; const consoleBox = document.getElementById('ternimalContainer'+this.idIndex); let width = document.body.clientWidth;//可视宽度 let height = parseInt(consoleBox.style.height); @@ -325,20 +324,21 @@ export default { cols:this.term.cols,//cols和rows在resizeConsole方法已经设置 rows:this.term.rows, }; - // alert(JSON.stringify(winStyle)); - this.$post('terminal/resize',winStyle).then(response => { - if (response.code === 200) { - this.term.fit(); - //this.term.scrollToBottom(); - } else { - this.$message.error(response.msg); - } - }); //调整终端可视区域高度 document.getElementsByClassName('xterm-screen')[this.idIndex].style.height=height+'px' this.$nextTick(()=>{ this.term.resize(this.term.cols,this.term.rows); }) + // alert(JSON.stringify(winStyle)); + // this.$post('terminal/resize',winStyle).then(response => { + // if (response.code === 200) { + // this.term.fit(); + // //this.term.scrollToBottom(); + // } else { + // this.$message.error(response.msg); + // } + // }); + // console.log(winStyle) } }, diff --git a/nezha-fronted/src/components/cli/webSSH.vue b/nezha-fronted/src/components/cli/webSSH.vue index 3c23fad7f..a9f11f543 100644 --- a/nezha-fronted/src/components/cli/webSSH.vue +++ b/nezha-fronted/src/components/cli/webSSH.vue @@ -6,7 +6,7 @@
- + @@ -51,7 +51,7 @@ style="margin-top: 0px;">
{{item.title}} - + @@ -175,6 +175,7 @@ }, data() { + let termFontSize=parseInt(localStorage.getItem("termFontSize")); return { consoleShow:false, isFullScreen:false, @@ -200,7 +201,7 @@ downloadFileList:[], downloadResult:null, // 字体大小 - fontSize:15, + fontSize:termFontSize?termFontSize:15, } }, methods: { @@ -576,6 +577,7 @@ changeFontSize(fontSize){ // this.$refs['console'+this.index].setFontSize(fontSize); this.fontSize=fontSize; + localStorage.setItem("termFontSize", fontSize); this.editableTabs.forEach((tab, index) => { this.$refs['console'+index][0].setFontSize(fontSize); });