Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

不能将类型“DataItem[]”分配给类型“CascaderOption[]” #89

Open
leosin opened this issue Aug 5, 2023 · 3 comments
Open

Comments

@leosin
Copy link

leosin commented Aug 5, 2023

正常引入

import { pcTextArr } from 'element-china-area-data'

正常使用

<el-cascader v-model="selectedCascader" :options="pcTextArr" @change="handleChange" />

但是却报类型错误

不能将类型“DataItem[]”分配给类型“CascaderOption[]”。
不能将类型“DataItem”分配给类型“CascaderOption”

相关版本:
"element-china-area-data": "^6.0.2",
"element-plus": "^2.3.8"
"typescript": "^5.1.6",
"nuxt": "^3.6.5",

@cvpv
Copy link

cvpv commented Sep 18, 2023

image
同样错误,ts适配还有问题

@cvpv
Copy link

cvpv commented Sep 18, 2023

:options="(pcaTextArr as any[])" 吧,我也没整明白,明明接口一样,为什么不能判等

@976977577
Copy link

import type { CascaderOption } from 'element-plus/es/components'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants