Последняя версия с сервера прошлого разработчика
This commit is contained in:
45
resources/js/Shared/Form/TextInput.vue
Executable file
45
resources/js/Shared/Form/TextInput.vue
Executable file
@@ -0,0 +1,45 @@
|
||||
<template>
|
||||
<label v-if="label" class="text-gray-light text-lg mb-2"
|
||||
:for="id"
|
||||
>{{ label }}:</label>
|
||||
<input :id="id" ref="input"
|
||||
v-bind="$attrs" :class="{ error: error }"
|
||||
:type="type" :value="modelValue"
|
||||
@input="$emit('update:modelValue', $event.target.value)"
|
||||
>
|
||||
<div v-if="error" class="text-red text-sm">
|
||||
{{ error }}
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
props: {
|
||||
id: {
|
||||
type: String,
|
||||
default() {
|
||||
return `select-input-${Math.random() * 1000}`
|
||||
},
|
||||
},
|
||||
type: {
|
||||
type: String,
|
||||
default: 'text',
|
||||
},
|
||||
modelValue: [String, Number],
|
||||
label: String,
|
||||
error: String,
|
||||
},
|
||||
emits: ['update:modelValue'],
|
||||
methods: {
|
||||
focus() {
|
||||
this.$refs.input.focus()
|
||||
},
|
||||
select() {
|
||||
this.$refs.input.select()
|
||||
},
|
||||
setSelectionRange(start, end) {
|
||||
this.$refs.input.setSelectionRange(start, end)
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user