页面部分:
<div class="block">
<el-cascader
v-model="form.region"
:options="reclassifyList"
:props="{ value: 'id',label: 'name',children: 'children'}"//根据得到的数组结构自定义变更
@change="handleChange"></el-cascader>
</div>
// 引入API中js的方法
// 获得商品分类列表
export function getProductCategoryList(query) {
return request({
url: '/cems/category/list',
method: 'get',
params: query
})
}
//三级列表
// 执行查询
//methods:部分:
//查看更改值
handleChange(value) {
console.log(value);
},
//请求数据方法
getProductCategoryList(this.queryParams).then(response => {
this.reclassifyList = this.handleTree(response.data, "id", "parentId");
this