从后端拿到arr数据结构:
cityList: [ { id: 1, name: '北京', child: [ id: 11, name: '大兴区', child: [ id: 111, name: '亦庄' ] ] } ]
vue文件代码
<template> <el-cascader :options="cityList" :props="optionProps" v-model="selectedOptions" @change="handleChange"> </el-cascader> </template> <script> data: { optionProps: { value: 'id', label: 'name', children: 'child' } } </script>