Skip to content

Instantly share code, notes, and snippets.

@silvandiepen
Created November 29, 2022 11:37
Show Gist options
  • Save silvandiepen/a2c7a69e71700ad0469a5f57713d164a to your computer and use it in GitHub Desktop.
Save silvandiepen/a2c7a69e71700ad0469a5f57713d164a to your computer and use it in GitHub Desktop.
Vue3 setup Input component base
<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