从后端拿到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'
	}
}

 

Logo

前往低代码交流专区

更多推荐