From 0b9a378c10bed33807ce3f104dd213538463db8a Mon Sep 17 00:00:00 2001 From: Jacky Date: Tue, 16 Mar 2021 18:12:10 +0800 Subject: [PATCH] Allow Tab in textarea --- nginx-ui-frontend/src/views/DomainEdit.vue | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/nginx-ui-frontend/src/views/DomainEdit.vue b/nginx-ui-frontend/src/views/DomainEdit.vue index 7f3acdfe..a0d51c21 100644 --- a/nginx-ui-frontend/src/views/DomainEdit.vue +++ b/nginx-ui-frontend/src/views/DomainEdit.vue @@ -7,7 +7,11 @@ - + @@ -222,6 +226,17 @@ export default { console.log(r) this.$message.error("保存错误") }) + }, + pressTab(event) { + if (event) { + let text = this.configText, + originalSelectionStart = event.target.selectionStart, + textStart = text.slice(0, originalSelectionStart), + textEnd = text.slice(originalSelectionStart); + event.target.selectionEnd = event.target.selectionStart + 1 + this.configText = `${textStart}\t${textEnd}` + event.target.selectionEnd = event.target.selectionStart = originalSelectionStart + 1 + } } } }