2021-08-18 00:01:11 +02:00
|
|
|
<template>
|
2021-09-05 20:21:02 +02:00
|
|
|
<input v-model="inputValue" :type="type" :readonly="readonly" :disabled="disabled" :placeholder="placeholder" class="rounded bg-primary text-gray-200 focus:border-gray-500 focus:outline-none border border-gray-600" :class="classList" @keyup="keyup" @change="change" @focus="focused" @blur="blurred" />
|
2021-08-18 00:01:11 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
export default {
|
|
|
|
props: {
|
|
|
|
value: [String, Number],
|
|
|
|
placeholder: String,
|
|
|
|
readonly: Boolean,
|
|
|
|
type: {
|
|
|
|
type: String,
|
|
|
|
default: 'text'
|
|
|
|
},
|
2021-09-05 20:21:02 +02:00
|
|
|
disabled: Boolean,
|
|
|
|
paddingY: {
|
|
|
|
type: Number,
|
|
|
|
default: 2
|
|
|
|
},
|
|
|
|
paddingX: {
|
|
|
|
type: Number,
|
|
|
|
default: 3
|
|
|
|
}
|
2021-08-18 00:01:11 +02:00
|
|
|
},
|
|
|
|
data() {
|
|
|
|
return {}
|
|
|
|
},
|
|
|
|
computed: {
|
|
|
|
inputValue: {
|
|
|
|
get() {
|
|
|
|
return this.value
|
|
|
|
},
|
|
|
|
set(val) {
|
|
|
|
this.$emit('input', val)
|
|
|
|
}
|
2021-09-05 20:21:02 +02:00
|
|
|
},
|
|
|
|
classList() {
|
|
|
|
var _list = []
|
|
|
|
_list.push(`px-${this.paddingX}`)
|
|
|
|
_list.push(`py-${this.paddingY}`)
|
|
|
|
return _list.join(' ')
|
2021-08-18 00:01:11 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
methods: {
|
2021-08-21 23:23:35 +02:00
|
|
|
focused() {
|
|
|
|
this.$emit('focus')
|
|
|
|
},
|
|
|
|
blurred() {
|
|
|
|
this.$emit('blur')
|
|
|
|
},
|
2021-08-18 00:01:11 +02:00
|
|
|
change(e) {
|
|
|
|
this.$emit('change', e.target.value)
|
2021-08-21 23:23:35 +02:00
|
|
|
},
|
|
|
|
keyup(e) {
|
|
|
|
this.$emit('keyup', e)
|
2021-08-18 00:01:11 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
mounted() {}
|
|
|
|
}
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style scoped>
|
|
|
|
input {
|
|
|
|
border-style: inherit !important;
|
|
|
|
}
|
|
|
|
input:read-only {
|
|
|
|
background-color: #444;
|
|
|
|
}
|
|
|
|
</style>
|