fix: 终端操作col和row初始化问题修复

This commit is contained in:
meilin.huang
2024-02-18 18:42:25 +08:00
parent d711a36749
commit 2133d9b737
4 changed files with 23 additions and 15 deletions

View File

@@ -22,7 +22,7 @@
### 介绍
web 版 **linux(终端[终端回放] 文件 脚本 进程 计划任务)、数据库mysql postgres oracle 达梦 高斯 sqlite、redis(单机 哨兵 集群)、mongo 统一管理操作平台**
web 版 **linux(终端[终端回放] 文件 脚本 进程 计划任务)、数据库mysql postgres oracle sqlserver 达梦 高斯 sqlite、redis(单机 哨兵 集群)、mongo 统一管理操作平台**
### 开发语言与主要框架

View File

@@ -17,12 +17,12 @@
"countup.js": "^2.7.0",
"cropperjs": "^1.5.11",
"echarts": "^5.4.3",
"element-plus": "^2.5.5",
"element-plus": "^2.5.6",
"js-base64": "^3.7.5",
"jsencrypt": "^3.3.2",
"lodash": "^4.17.21",
"mitt": "^3.0.1",
"monaco-editor": "^0.45.0",
"monaco-editor": "^0.46.0",
"monaco-sql-languages": "^0.11.0",
"monaco-themes": "^0.4.4",
"nprogress": "^0.2.0",
@@ -33,7 +33,7 @@
"splitpanes": "^3.1.5",
"sql-formatter": "^15.0.2",
"uuid": "^9.0.1",
"vue": "^3.4.15",
"vue": "^3.4.19",
"vue-router": "^4.2.5",
"xterm": "^5.3.0",
"xterm-addon-fit": "^0.8.0",
@@ -48,16 +48,16 @@
"@typescript-eslint/eslint-plugin": "^6.7.4",
"@typescript-eslint/parser": "^6.7.4",
"@vitejs/plugin-vue": "^5.0.3",
"@vue/compiler-sfc": "^3.4.14",
"@vue/compiler-sfc": "^3.4.19",
"code-inspector-plugin": "^0.4.5",
"dotenv": "^16.3.1",
"eslint": "^8.35.0",
"eslint-plugin-vue": "^9.19.2",
"prettier": "^3.1.0",
"eslint-plugin-vue": "^9.21.1",
"prettier": "^3.2.5",
"sass": "^1.69.0",
"typescript": "^5.3.2",
"vite": "^5.0.12",
"vue-eslint-parser": "^9.4.0"
"vite": "^5.1.3",
"vue-eslint-parser": "^9.4.2"
},
"browserslist": [
"> 1%",

View File

@@ -106,7 +106,6 @@ function init() {
const fitAddon = new FitAddon();
state.addon.fit = fitAddon;
term.loadAddon(fitAddon);
resize();
// 注册搜索组件
const searchAddon = new SearchAddon();
@@ -118,6 +117,7 @@ function init() {
state.addon.weblinks = weblinks;
term.loadAddon(weblinks);
fitTerminal();
// 初始化websocket
initSocket();
}
@@ -159,7 +159,15 @@ const onConnected = () => {
// 自适应终端
const fitTerminal = () => {
resize();
// 获取建议的宽度和高度
const dimensions = state.addon.fit?.proposeDimensions();
if (!dimensions) {
return;
}
if (dimensions?.cols && dimensions?.rows) {
// 调整终端的列数和行数
term.resize(dimensions.cols, dimensions.rows);
}
};
const focus = () => {

View File

@@ -30,14 +30,14 @@ require (
github.com/sijms/go-ora/v2 v2.8.7
github.com/stretchr/testify v1.8.4
go.mongodb.org/mongo-driver v1.13.1 // mongo
golang.org/x/crypto v0.18.0 // ssh
golang.org/x/crypto v0.19.0 // ssh
golang.org/x/oauth2 v0.15.0
golang.org/x/sync v0.6.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/yaml.v3 v3.0.1
// gorm
gorm.io/driver/mysql v1.5.2
gorm.io/gorm v1.25.6
gorm.io/driver/mysql v1.5.4
gorm.io/gorm v1.25.7
)
require (
@@ -87,7 +87,7 @@ require (
golang.org/x/exp v0.0.0-20230519143937-03e91628a987 // indirect
golang.org/x/image v0.13.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/sys v0.17.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230131230820-1c016267d619 // indirect