Skip to content

Commit 8742637

Browse files
author
“RafaelGondi”
committed
feat: adiciona prop readonly no BaseInput
1 parent 7241c01 commit 8742637

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

src/components/BaseInput.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@
8686
ref="htmlInput"
8787
v-model="internalValue"
8888
:required="required"
89+
:readonly="readonly"
8990
:placeholder="placeholder"
9091
:disabled="disabled"
9192
:class="inputClass"
@@ -297,6 +298,10 @@ const props = defineProps({
297298
type: Boolean,
298299
default: false,
299300
},
301+
readonly: {
302+
type: Boolean,
303+
default: false,
304+
},
300305
});
301306
302307
const emits = defineEmits({
@@ -389,13 +394,13 @@ onMounted(() => {
389394
});
390395
391396
/* FUNCTIONS */
392-
function handleClick() {
397+
function handleClick(event) {
393398
/**
394399
* Evento emitido quando o componente é clicado.
395400
* @event click
396401
* @type {Event}
397402
*/
398-
emitClick();
403+
emitClick(event);
399404
}
400405
401406
function handleFocus() {

src/components/BaseMobileInput.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
:required="required"
4747
:disabled="disabled"
4848
:class="inputClass"
49+
:readonly="readonly"
4950
:type="type"
5051
@focus="handleFocus"
5152
@blur="handleBlur"
@@ -205,7 +206,7 @@
205206
</template>
206207

207208
<script setup>
208-
import { ref, computed, watch, useTemplateRef, useAttrs } from 'vue';
209+
import { ref, computed, watch, useTemplateRef, useAttrs, readonly } from 'vue';
209210
import {
210211
nativeEvents,
211212
nativeEmits,
@@ -341,6 +342,10 @@ const props = defineProps({
341342
type: Boolean,
342343
default: false,
343344
},
345+
readonly: {
346+
type: Boolean,
347+
default: false,
348+
},
344349
});
345350
346351
const emits = defineEmits({
@@ -450,13 +455,13 @@ watch(internalValue, (value) => {
450455
});
451456
452457
/* FUNCTIONS */
453-
function handleClick() {
458+
function handleClick(event) {
454459
/**
455460
* Evento emitido quando o componente é clicado.
456461
* @event click
457462
* @type {Event}
458463
*/
459-
emitClick();
464+
emitClick(event);
460465
componentRef.value.focus();
461466
}
462467

0 commit comments

Comments
 (0)