mirror of
https://github.com/hay-kot/homebox.git
synced 2024-12-27 09:16:30 +00:00
75c633dcb5
* dummy commit * cleanup workflows * setup and run eslint * add linter to CI * use eslint for formatting * reorder rules * drop editor config
52 lines
1.1 KiB
Vue
52 lines
1.1 KiB
Vue
<template>
|
|
<div v-if="!inline" class="form-control w-full">
|
|
<label class="label">
|
|
<span class="label-text">{{ label }}</span>
|
|
</label>
|
|
<input ref="input" v-model="value" :type="type" class="input input-bordered w-full" />
|
|
</div>
|
|
<div v-else class="sm:grid sm:grid-cols-4 sm:items-start sm:gap-4">
|
|
<label class="label">
|
|
<span class="label-text">{{ label }}</span>
|
|
</label>
|
|
<input v-model="value" class="input input-bordered col-span-3 w-full mt-2" />
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
const props = defineProps({
|
|
label: {
|
|
type: String,
|
|
default: "",
|
|
},
|
|
modelValue: {
|
|
type: [String, Number],
|
|
default: null,
|
|
},
|
|
type: {
|
|
type: String,
|
|
default: "text",
|
|
},
|
|
triggerFocus: {
|
|
type: Boolean,
|
|
default: null,
|
|
},
|
|
inline: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
});
|
|
|
|
const input = ref<HTMLElement | null>(null);
|
|
|
|
whenever(
|
|
() => props.triggerFocus,
|
|
() => {
|
|
if (input.value) {
|
|
input.value.focus();
|
|
}
|
|
}
|
|
);
|
|
|
|
const value = useVModel(props, "modelValue");
|
|
</script>
|