Closed shallow-time closed 1 year ago
你可以通过onChange
事件取到完整的国籍信息的
但是数据回显的话,只支持国家代码才能回显
国家代码也能正确回显国家名称的,你用的是哪种模式?你想要的是什么效果?
国家代码也能正确回显国家名称的,你用的是哪种模式?你想要的是什么效果?
country 模式,我想要实现:选中国家,显示的的是国家英文名称,或者国家简写,而不是国家代码。编辑的时候可以根据国家英文名称或者国家简写回显。
国家代码也能正确回显国家名称的,你用的是哪种模式?你想要的是什么效果?
还有个问题,type为phone是,我设置默认值为1,显示的却是canada,而不是United States,我通过onChange打印发现他们两的dialCode字段都是1,请问如果我要设置默认号码为United States如何设置。
<template>
<VueCountryIntl type="country" v-model="country" no-data-text="没有找到相关数据"></VueCountryIntl>
</template>
<script setup>
import { ref } from 'vue';
let country = ref('cn');
</script>
设置type=country
就可以呀
<template> <VueCountryIntl type="country" v-model="country" no-data-text="没有找到相关数据"></VueCountryIntl> </template> <script setup> import { ref } from 'vue'; let country = ref('cn'); </script>
设置
type=country
就可以呀
你这个country为cn只是国家代码,展示给用户看别人是看不懂的,别人一般都是看国家英文名称,或者简写,而不是国家代码。我看到通过onChange中name字段可以获取到国家英文名称,但是回显的时候回显不了
国家代码也能正确回显国家名称的,你用的是哪种模式?你想要的是什么效果?
还有个问题,type为phone是,我设置默认值为1,显示的却是canada,而不是United States,我通过onChange打印发现他们两的dialCode字段都是1,请问如果我要设置默认号码为United States如何设置。
设置iso2
prop,值为国籍代码。如果未传递iso2
,当多个国家的区号是一样时优先取查找到的第一个国家的区号
<template> <VueCountryIntl type="country" v-model="country" no-data-text="没有找到相关数据"></VueCountryIntl> </template> <script setup> import { ref } from 'vue'; let country = ref('cn'); </script>
设置
type=country
就可以呀你这个country为cn只是国家代码,展示给用户看别人是看不懂的,别人一般都是看国家英文名称,或者简写,而不是国家代码。我看到通过onChange中name字段可以获取到国家英文名称,但是回显的时候回显不了
你用的是scheme = popover
模式吗?
<template> <VueCountryIntl type="country" v-model="country" no-data-text="没有找到相关数据"></VueCountryIntl> </template> <script setup> import { ref } from 'vue'; let country = ref('cn'); </script>
设置
type=country
就可以呀你这个country为cn只是国家代码,展示给用户看别人是看不懂的,别人一般都是看国家英文名称,或者简写,而不是国家代码。我看到通过onChange中name字段可以获取到国家英文名称,但是回显的时候回显不了
你用的是
scheme = popover
模式吗?
scheme = input 模式:<Vue3CountryIntl @onChange="getCountry" type="country" v-model="addProviderForm.country"/>
<template> <VueCountryIntl type="country" v-model="country" no-data-text="没有找到相关数据"></VueCountryIntl> </template> <script setup> import { ref } from 'vue'; let country = ref('cn'); </script>
设置
type=country
就可以呀你这个country为cn只是国家代码,展示给用户看别人是看不懂的,别人一般都是看国家英文名称,或者简写,而不是国家代码。我看到通过onChange中name字段可以获取到国家英文名称,但是回显的时候回显不了
你用的是
scheme = popover
模式吗?scheme = input 模式:<Vue3CountryIntl @onchange="getCountry" type="country" v-model="addProviderForm.country"/>
scheme = input
模式默认就可以回显的呀,要不你录个视频,然后再贴下你的代码
<template> <VueCountryIntl type="country" v-model="country" no-data-text="没有找到相关数据"></VueCountryIntl> </template> <script setup> import { ref } from 'vue'; let country = ref('cn'); </script>
设置
type=country
就可以呀你这个country为cn只是国家代码,展示给用户看别人是看不懂的,别人一般都是看国家英文名称,或者简写,而不是国家代码。我看到通过onChange中name字段可以获取到国家英文名称,但是回显的时候回显不了
你用的是
scheme = popover
模式吗?scheme = input 模式:<Vue3CountryIntl @onchange="getCountry" type="country" v-model="addProviderForm.country"/>
scheme = input
模式默认就可以回显的呀,要不你录个视频,然后再贴下你的代码
<template> <VueCountryIntl type="country" v-model="country" no-data-text="没有找到相关数据"></VueCountryIntl> </template> <script setup> import { ref } from 'vue'; let country = ref('cn'); </script>
设置
type=country
就可以呀你这个country为cn只是国家代码,展示给用户看别人是看不懂的,别人一般都是看国家英文名称,或者简写,而不是国家代码。我看到通过onChange中name字段可以获取到国家英文名称,但是回显的时候回显不了
你用的是
scheme = popover
模式吗?scheme = input 模式:<Vue3CountryIntl @onchange="getCountry" type="country" v-model="addProviderForm.country"/>
scheme = input
模式默认就可以回显的呀,要不你录个视频,然后再贴下你的代码
addProviderForm .country
为us
的时候能正确回显不是你要的效果么?还是说name
你在其他地方需要用到?
国家代码也能正确回显国家名称的,你用的是哪种模式?你想要的是什么效果?
还有个问题,type为phone是,我设置默认值为1,显示的却是canada,而不是United States,我通过onChange打印发现他们两的dialCode字段都是1,请问如果我要设置默认号码为United States如何设置。
设置
iso2
prop,值为国籍代码。如果未传递iso2
,当多个国家的区号是一样时优先取查找到的第一个国家的区号
能否提供一个传递‘iso2’的demo
<template> <VueCountryIntl type="country" v-model="country" no-data-text="没有找到相关数据"></VueCountryIntl> </template> <script setup> import { ref } from 'vue'; let country = ref('cn'); </script>
设置
type=country
就可以呀你这个country为cn只是国家代码,展示给用户看别人是看不懂的,别人一般都是看国家英文名称,或者简写,而不是国家代码。我看到通过onChange中name字段可以获取到国家英文名称,但是回显的时候回显不了
你用的是
scheme = popover
模式吗?scheme = input 模式:<Vue3CountryIntl @onchange="getCountry" type="country" v-model="addProviderForm.country"/>
scheme = input
模式默认就可以回显的呀,要不你录个视频,然后再贴下你的代码
addProviderForm .country
为us
的时候能正确回显不是你要的效果么?还是说name
你在其他地方需要用到?
我想要实现,country: 'United States',也能回显,因为用户想看的是你国家名字,一般看的是'United States',而不是‘us’ 。
国家代码也能正确回显国家名称的,你用的是哪种模式?你想要的是什么效果?
还有个问题,type为phone是,我设置默认值为1,显示的却是canada,而不是United States,我通过onChange打印发现他们两的dialCode字段都是1,请问如果我要设置默认号码为United States如何设置。
设置
iso2
prop,值为国籍代码。如果未传递iso2
,当多个国家的区号是一样时优先取查找到的第一个国家的区号能否提供一个传递‘iso2’的demo
<template>
<Vue3CountryIntl @onchange="getCountry" type="country" :iso2="iso2" v-model="country" @onChange="onChange" />
</template>
<script setup>
import { ref } from 'vue';
let iso2 = ref('');
let country = ref('');
let onChange = function (countryInfo) {
iso2.value = countryInfo.iso2
}
</script>
<template> <VueCountryIntl type="country" v-model="country" no-data-text="没有找到相关数据"></VueCountryIntl> </template> <script setup> import { ref } from 'vue'; let country = ref('cn'); </script>
设置
type=country
就可以呀你这个country为cn只是国家代码,展示给用户看别人是看不懂的,别人一般都是看国家英文名称,或者简写,而不是国家代码。我看到通过onChange中name字段可以获取到国家英文名称,但是回显的时候回显不了
你用的是
scheme = popover
模式吗?scheme = input 模式:<Vue3CountryIntl @onchange="getCountry" type="country" v-model="addProviderForm.country"/>
scheme = input
模式默认就可以回显的呀,要不你录个视频,然后再贴下你的代码
addProviderForm .country
为us
的时候能正确回显不是你要的效果么?还是说name
你在其他地方需要用到?我想要实现,country: 'United States',也能回显,因为用户想看的是你国家名字,一般看的是'United States',而不是‘us’ 。
这样不是你想要的?
对,我希望可以自定义节点,可以参考antv的select组件的fieldNames设置。
国家代码也能正确回显国家名称的,你用的是哪种模式?你想要的是什么效果?
还有个问题,type为phone是,我设置默认值为1,显示的却是canada,而不是United States,我通过onChange打印发现他们两的dialCode字段都是1,请问如果我要设置默认号码为United States如何设置。
设置
iso2
prop,值为国籍代码。如果未传递iso2
,当多个国家的区号是一样时优先取查找到的第一个国家的区号能否提供一个传递‘iso2’的demo
<template> <Vue3CountryIntl @onchange="getCountry" type="country" :iso2="iso2" v-model="country" @onChange="onChange" /> </template> <script setup> import { ref } from 'vue'; let iso2 = ref(''); let country = ref(''); let onChange = function (countryInfo) { iso2.value = countryInfo.iso2 } </script>
<template> <Vue3CountryIntl @onchange="getCountry" type="country" :iso2="iso2" v-model="country" @onChange="onChange" /> </template> <script setup> import { ref } from 'vue'; let iso2 = ref('us'); // 我默认为us,但是显示不出来 let country = ref(''); let onChange = function (countryInfo) { iso2.value = countryInfo.iso2 } </script>
国家代码也能正确回显国家名称的,你用的是哪种模式?你想要的是什么效果?
还有个问题,type为phone是,我设置默认值为1,显示的却是canada,而不是United States,我通过onChange打印发现他们两的dialCode字段都是1,请问如果我要设置默认号码为United States如何设置。
设置
iso2
prop,值为国籍代码。如果未传递iso2
,当多个国家的区号是一样时优先取查找到的第一个国家的区号能否提供一个传递‘iso2’的demo
<template> <Vue3CountryIntl @onchange="getCountry" type="country" :iso2="iso2" v-model="country" @onChange="onChange" /> </template> <script setup> import { ref } from 'vue'; let iso2 = ref(''); let country = ref(''); let onChange = function (countryInfo) { iso2.value = countryInfo.iso2 } </script>
<template> <Vue3CountryIntl @onchange="getCountry" type="country" :iso2="iso2" v-model="country" @onChange="onChange" /> </template> <script setup> import { ref } from 'vue'; let iso2 = ref('us'); // 我默认为us,但是显示不出来 let country = ref(''); let onChange = function (countryInfo) { iso2.value = countryInfo.iso2 } </script>
country
没有值,肯定显示不出来
对,我希望可以自定义节点,可以参考antv的select组件的fieldNames设置。
自定义节点功能暂不支持,我可以提供一个函数给你根据国籍代码或国籍区号去查询国籍信息
国家代码也能正确回显国家名称的,你用的是哪种模式?你想要的是什么效果?
还有个问题,type为phone是,我设置默认值为1,显示的却是canada,而不是United States,我通过onChange打印发现他们两的dialCode字段都是1,请问如果我要设置默认号码为United States如何设置。
设置
iso2
prop,值为国籍代码。如果未传递iso2
,当多个国家的区号是一样时优先取查找到的第一个国家的区号能否提供一个传递‘iso2’的demo
<template> <Vue3CountryIntl @onchange="getCountry" type="country" :iso2="iso2" v-model="country" @onChange="onChange" /> </template> <script setup> import { ref } from 'vue'; let iso2 = ref(''); let country = ref(''); let onChange = function (countryInfo) { iso2.value = countryInfo.iso2 } </script>
<template> <Vue3CountryIntl @onchange="getCountry" type="country" :iso2="iso2" v-model="country" @onChange="onChange" /> </template> <script setup> import { ref } from 'vue'; let iso2 = ref('us'); // 我默认为us,但是显示不出来 let country = ref(''); let onChange = function (countryInfo) { iso2.value = countryInfo.iso2 } </script>
country
没有值,肯定显示不出来<template> <Vue3CountryIntl @onchange="getCountry" type="phone" :iso2="iso2" v-model="country" @onChange="onChange" /> </template> <script setup> import { ref } from 'vue'; let iso2 = ref('us'); // 我默认为us,但是显示不出来 let country = ref('+1'); // type: 为phone,country 设置的是:+1 let onChange = function (countryInfo) { iso2.value = countryInfo.iso2 } </script>
对,我希望可以自定义节点,可以参考antv的select组件的fieldNames设置。
自定义节点功能暂不支持,我可以提供一个函数给你根据国籍代码或国籍区号去查询国籍信息
可以
国家代码也能正确回显国家名称的,你用的是哪种模式?你想要的是什么效果?
还有个问题,type为phone是,我设置默认值为1,显示的却是canada,而不是United States,我通过onChange打印发现他们两的dialCode字段都是1,请问如果我要设置默认号码为United States如何设置。
设置
iso2
prop,值为国籍代码。如果未传递iso2
,当多个国家的区号是一样时优先取查找到的第一个国家的区号能否提供一个传递‘iso2’的demo
<template> <Vue3CountryIntl @onchange="getCountry" type="country" :iso2="iso2" v-model="country" @onChange="onChange" /> </template> <script setup> import { ref } from 'vue'; let iso2 = ref(''); let country = ref(''); let onChange = function (countryInfo) { iso2.value = countryInfo.iso2 } </script>
<template> <Vue3CountryIntl @onchange="getCountry" type="country" :iso2="iso2" v-model="country" @onChange="onChange" /> </template> <script setup> import { ref } from 'vue'; let iso2 = ref('us'); // 我默认为us,但是显示不出来 let country = ref(''); let onChange = function (countryInfo) { iso2.value = countryInfo.iso2 } </script>
country
没有值,肯定显示不出来<template> <Vue3CountryIntl @onchange="getCountry" type="phone" :iso2="iso2" v-model="country" @onChange="onChange" /> </template> <script setup> import { ref } from 'vue'; let iso2 = ref('us'); // 我默认为us,但是显示不出来 let country = ref('+1'); // type: 为phone,country 设置的是:+1 let onChange = function (countryInfo) { iso2.value = countryInfo.iso2 } </script>
type为phone,iso2和绑定的数据都设置了默认值,但是控件没有显示默认数据
国家代码也能正确回显国家名称的,你用的是哪种模式?你想要的是什么效果?
还有个问题,type为phone是,我设置默认值为1,显示的却是canada,而不是United States,我通过onChange打印发现他们两的dialCode字段都是1,请问如果我要设置默认号码为United States如何设置。
设置
iso2
prop,值为国籍代码。如果未传递iso2
,当多个国家的区号是一样时优先取查找到的第一个国家的区号能否提供一个传递‘iso2’的demo
<template> <Vue3CountryIntl @onchange="getCountry" type="country" :iso2="iso2" v-model="country" @onChange="onChange" /> </template> <script setup> import { ref } from 'vue'; let iso2 = ref(''); let country = ref(''); let onChange = function (countryInfo) { iso2.value = countryInfo.iso2 } </script>
<template> <Vue3CountryIntl @onchange="getCountry" type="country" :iso2="iso2" v-model="country" @onChange="onChange" /> </template> <script setup> import { ref } from 'vue'; let iso2 = ref('us'); // 我默认为us,但是显示不出来 let country = ref(''); let onChange = function (countryInfo) { iso2.value = countryInfo.iso2 } </script>
country
没有值,肯定显示不出来<template> <Vue3CountryIntl @onchange="getCountry" type="phone" :iso2="iso2" v-model="country" @onChange="onChange" /> </template> <script setup> import { ref } from 'vue'; let iso2 = ref('us'); // 我默认为us,但是显示不出来 let country = ref('+1'); // type: 为phone,country 设置的是:+1 let onChange = function (countryInfo) { iso2.value = countryInfo.iso2 } </script>
type为phone,iso2和绑定的数据都设置了默认值,但是控件没有显示默认数据
问题解决了,更新到1.0.16
版本即可,增加了一个getCountryInfo
函数可以获取国籍信息
目前type为country,选择国家时,value只能是国家代码,能不能换成国家英文名或者国家简写