I am using an NPM package, vue-tel-input. I created a separate component for that, like-
components/NPMPackages/VueTelInput/Index.vue
<script setup lang="ts">
import { VueTelInput } from 'vue-tel-input';
import 'vue-tel-input/vue-tel-input.css';
defineProps(['modelValue'])
defineEmits(['update:modelValue'])
</script>
<template>
<VueTelInput
:value="modelValue"
@input="$emit('update:modelValue', $event.target.value)"
>
</VueTelInput>
</template>
Now, I am importing this component inside my App.vue
, like this-
<script setup lang="ts">
import NPMPackageVueTelInput from '@/components/NPMPackages/VueTelInput/Index.vue'
const phone = ref('');
</script>
<template>
<NPMPackageVueTelInput v-model="phone"></NPMPackageVueTelInput>
</template>
But this code is not working. I am not able to type inside the input box, nothing is displaying.
Here is the types-definition for this package.
I am using the following environment-
Vue- 3.3.4
vite - 4.4.9
typescript - 5.1.6
If I do not make a common component, and use vue-tel-input
directly inside App.vue
, it works fine.
Any help would be great.