mirror of
https://github.com/0xJacky/nginx-ui.git
synced 2025-05-10 18:05:48 +02:00
Allow Tab in textarea
This commit is contained in:
parent
36e5af52ae
commit
0b9a378c10
1 changed files with 16 additions and 1 deletions
|
@ -7,7 +7,11 @@
|
|||
</a-col>
|
||||
<a-col :md="12" :sm="24">
|
||||
<a-card title="配置文件实时编辑">
|
||||
<a-textarea v-model="configText" :rows="36"/>
|
||||
<a-textarea
|
||||
v-model="configText"
|
||||
:rows="36"
|
||||
@keydown.tab.prevent="pressTab"
|
||||
/>
|
||||
</a-card>
|
||||
</a-col>
|
||||
<footer-tool-bar>
|
||||
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue