element中el-cascader使用props设置value、label、children
从后端拿到arr数据结构:cityList: [{id: 1,name: '北京',child: [id: 11,name: '大兴区',child: [id: 111,name: '亦庄']]}]vue文件代码<el-cascader:options="cityList":props="optionProps"v-model="selectedOptions".
·
从后端拿到arr数据结构:
cityList: [
{
id: 1,
name: '北京',
child: [
id: 11,
name: '大兴区',
child: [
id: 111,
name: '亦庄'
]
]
}
]
vue文件代码
<el-cascader
:options="cityList"
:props="optionProps"
v-model="selectedOptions"
@change="handleChange">
</el-cascader>
js
data: {
optionProps: {
value: 'id',
label: 'name',
children: 'child'
}
}
更多推荐
已为社区贡献9条内容
所有评论(0)