Vue.js 3 telepone field with country code input

Viewed 2273

Anyone know a way to insert a telephone field with a country code dropdown similar to the one in the link for vue3? https://www.npmjs.com/package/vue-tel-input

I had tried to use the package in the link but it throws the following error in console.

Uncaught (in promise) TypeError: selfHook.bind is not a function

attempted implementation:

main.js

import { createApp } from 'vue'
import VueTelInput from 'vue-tel-input'

const app = createApp(App);
app.use(VueTelInput)
app.mount('#app');

in the App.vue I just imported it like a component using the following code:

<vue-tel-input></vue-tel-input>
2 Answers

This library supports Vue 3 now. https://iamstevendao.github.io/vue-tel-input/documentation/next.html

npm install vue-tel-input@next

import { createApp } from 'vue';
import App from './App.vue';
import VueTelInput from 'vue-tel-input';
import 'vue-tel-input/dist/vue-tel-input.css';

const app = createApp(App);
app.use(VueTelInput);
app.mount('#app');

...

<template>
  <vue-tel-input v-model="phone"></vue-tel-input>
></template>
Related