[英]Why does my vue-tel-input country code dropdown not format properly in my vuejs app?
I installed the vue-tel-input library https://vuejsexamples.com/international-telephone-input-with-vue/ in my vuejs project.我在我的 vuejs 项目中安装了 vue-tel-input 库https://vuejsexamples.com/international-telephone-input-with-vue/ 。 Why does my input field look like this with no country flags and no country code?
为什么我的输入字段看起来像这样,没有国旗和国家代码?
This may be related to an error I saw when installing the yarn library...这可能与我在安装yarn库时看到的错误有关...
error /Users/xxx/Documents/Work/software/xx/xx/node_modules/vue-tel-input: Command failed.
Exit code: 1
Command: cd docs && npm ci --prefer-offline
Arguments:
Directory: /Users/xxx/Documents/Work/software/xx/xx/node_modules/vue-tel-input
Output:
/bin/sh: line 0: cd: docs: No such file or directory
[1]: https://i.stack.imgur.com/AwkyP.png
Here is my relevant component code...这是我的相关组件代码...
<template>
<div>
<VueTelInput v-model="phoneNumber" v-bind="bindProps"></VueTelInput>
</div>
</template>
<script>
import { VueTelInput } from 'vue-tel-input'
import 'vue-tel-input/dist/css/component.css'
import 'vue-tel-input/dist/css/sprite.css'
export default {
name: 'CuiRegister',
computed: {
...mapState(['settings']),
loading() {
return this.$store.state.user.loading
},
},
components: { VueTelInput }
}
</script>
尝试在 Vue https://www.npmjs.com/package/vue-tel-input的 main.js 中初始化 vue-tel-input 参考这个链接
You can use available props for the vue-tel-input library available here: https://iamstevendao.github.io/vue-tel-input/documentation/props.html你可以使用这里可用的 vue-tel-input 库的可用道具: https : //iamstevendao.github.io/vue-tel-input/documentation/props.html
To add country flags and country codes you'll need to use dropdownOptions.showFlags and dropdownOptions.showDialCodeInList props resepectively.要添加国家标志和国家代码,您需要分别使用dropdownOptions.showFlags和dropdownOptions.showDialCodeInList道具。 Remember dropdownOptions is an object hence you can include the prop as shown below:
记住dropdownOptions是一个对象,因此您可以包含如下所示的道具:
<VueTelInput v-model="phoneNumber" :dropdownOptions = "{showFlags:true, showDialCodeInList:true}" v-bind="bindProps"></VueTelInput>
Here is a demo for the same: https://iamstevendao.github.io/vue-tel-input/这是相同的演示: https : //iamstevendao.github.io/vue-tel-input/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.