element-china-area-data
element-china-area-data copied to clipboard
不能将类型“DataItem[]”分配给类型“CascaderOption[]”
正常引入
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",
同样错误,ts适配还有问题
先:options="(pcaTextArr as any[])"
吧,我也没整明白,明明接口一样,为什么不能判等
import type { CascaderOption } from 'element-plus/es/components'