如题,代码如下:
<nz-cascader
\[nzLoadData\]\="loadCityBuildingData"
\[(ngModel)\]\="selectedLocation"
(ngModelChange)\="onNewLocationModalChanges($event)"
\> </nz-cascader>
loadCityBuildingData(node: NzCascaderOption, index: number): PromiseLike<void\> {
console.log(this);
return new Promise(resolve => {
if (index < 0) {
this.cityService.getCities().subscribe(item => {
const cities = \[\];
item.forEach(city => {
cities.push({value: city.id, label: city.name});
});
node.children \= cities;
resolve();
});
} else if (index === 0) {
this.buildingService.getBuildingsByCityId(node.value).subscribe(item => {
const buildings = \[\];
item.forEach(building => {
buildings.push({value: building.id, label: building.name, isLeaf: true});
});
node.children \= buildings;
resolve();
});
}
});
}
遇到相同的问题,不知道解决了没 哭o(╥﹏╥)o