优化 WebSocket 工具

This commit is contained in:
2021-11-08 17:42:03 +08:00
parent 7910a93746
commit a51a363811
2 changed files with 21 additions and 5 deletions

View File

@@ -113,9 +113,10 @@ let navTools = {
}, },
'websocket': { 'websocket': {
title: 'WebSocket', title: 'WebSocket',
desc: 'WebSocket 测试工具',
component: 'OtherWebSocket', component: 'OtherWebSocket',
update: '20211106', update: '20211108',
version: '1', version: '2',
enabled: true enabled: true
}, },
} }

View File

@@ -186,6 +186,9 @@ export default {
mounted() { mounted() {
this.init(); this.init();
}, },
beforeDestroy () {
this.wsClose();
},
methods: { methods: {
/** /**
@@ -207,15 +210,25 @@ export default {
* 清空输入 * 清空输入
*/ */
clearInputs() { clearInputs() {
this.inputs = ''; const msg = '确定要清空输入内容吗?';
this.$confirm(msg, '确认', {
type: 'warning',
}).then(() => {
this.inputs = '';
}).catch(() => { });
}, },
/** /**
* 清空消息 * 清空消息
*/ */
clearMessages() { clearMessages() {
this.messages = []; const msg = '确定要清空消息内容吗?';
this.messageID = 0; this.$confirm(msg, '确认', {
type: 'warning',
}).then(() => {
this.messages = [];
this.messageID = 0;
}).catch(() => { });
}, },
/** /**
@@ -420,10 +433,12 @@ export default {
background-color: #FFF; background-color: #FFF;
line-height: 1.6em; line-height: 1.6em;
overflow-y: auto; overflow-y: auto;
user-select: text;
} }
.item { .item {
margin: 0.5rem 0; margin: 0.5rem 0;
word-break: break-all;
} }
.el-tag { .el-tag {