emplementado entrada numero e entrada texto
This commit is contained in:
parent
fa1f93aedc
commit
de7c19be24
39 changed files with 2155 additions and 1058 deletions
57
src/componentes/EliEntrada/EliEntradaTexto.vue
Normal file
57
src/componentes/EliEntrada/EliEntradaTexto.vue
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
<template>
|
||||
<v-text-field
|
||||
v-model="localValue"
|
||||
:label="opcoes?.rotulo"
|
||||
:placeholder="opcoes?.placeholder"
|
||||
:counter="opcoes?.limiteCaracteres"
|
||||
:maxlength="opcoes?.limiteCaracteres"
|
||||
v-bind="attrs"
|
||||
@focus="() => emit('focus')"
|
||||
@blur="() => emit('blur')"
|
||||
/>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { computed, defineComponent, PropType } from "vue";
|
||||
import type { PadroesEntradas } from "./tiposEntradas";
|
||||
|
||||
type EntradaTexto = PadroesEntradas["texto"];
|
||||
|
||||
export default defineComponent({
|
||||
name: "EliEntradaTexto",
|
||||
inheritAttrs: false,
|
||||
props: {
|
||||
/** Interface padrão (EliEntrada): value + opcoes. */
|
||||
value: {
|
||||
type: [String, null] as unknown as PropType<EntradaTexto["value"]>,
|
||||
default: undefined,
|
||||
},
|
||||
opcoes: {
|
||||
type: Object as PropType<EntradaTexto["opcoes"]>,
|
||||
required: true,
|
||||
},
|
||||
},
|
||||
emits: {
|
||||
"update:value": (_v: EntradaTexto["value"]) => true,
|
||||
/** Compat Vue2 (v-model padrão: value + input) */
|
||||
input: (_v: EntradaTexto["value"]) => true,
|
||||
change: (_v: EntradaTexto["value"]) => true,
|
||||
focus: () => true,
|
||||
blur: () => true,
|
||||
},
|
||||
setup(props, { attrs, emit }) {
|
||||
const localValue = computed<EntradaTexto["value"]>({
|
||||
get: () => props.value,
|
||||
set: (v) => {
|
||||
emit("update:value", v);
|
||||
emit("input", v);
|
||||
emit("change", v);
|
||||
},
|
||||
});
|
||||
|
||||
return { attrs, emit, localValue };
|
||||
},
|
||||
});
|
||||
</script>
|
||||
|
||||
<style scoped></style>
|
||||
Loading…
Add table
Add a link
Reference in a new issue