1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 18:18:53 +08:00

add tests for DelimiterSelector #27

This commit is contained in:
lana-k
2021-04-16 15:14:41 +02:00
parent 5c9a5560b7
commit 6ce5d2b201
2 changed files with 96 additions and 11 deletions

View File

@@ -10,9 +10,9 @@
<input
ref="delimiterInput"
type="text"
maxlength="1"
:value="value"
@click.stop
@keypress="onKeyPress"
@input.prevent="onInput($event)"
:disabled="disabled"
/>
@@ -46,7 +46,7 @@ import ClearIcon from '@/components/svg/clear'
export default {
name: 'DelimiterSelector',
props: ['label', 'value', 'width', 'disabled'],
props: ['value', 'width', 'disabled'],
components: { DropDownChevron, ClearIcon },
data () {
return {
@@ -61,19 +61,11 @@ export default {
}
return ascii[str.charCodeAt(0).toString()].name
},
onKeyPress (event) {
if (event.target.value.length >= 1) {
event.preventDefault()
}
},
onInput (event) {
const value = event.target.value
if (value.length > 1) {
event.target.value = value[0]
}
if (value) {
this.$emit('input', event.target.value)
this.$emit('input', value)
}
},
chooseOption (option) {