Created
November 29, 2022 11:37
-
-
Save silvandiepen/a2c7a69e71700ad0469a5f57713d164a to your computer and use it in GitHub Desktop.
Vue3 setup Input component base
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<input type="text" v-model="value" /> | |
</template> | |
<script lang="ts" setup> | |
const props = defineProps({ | |
modelValue: { | |
type: String, | |
default: "" | |
} | |
}) | |
const emit = defineEmits(["update:modelValue", "blur"]); | |
const value = computed({ | |
get() { | |
return props.modelValue; | |
}, | |
set(value) { | |
emit("update:modelValue", value); | |
}, | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment