diff --git a/packages/boundary/src/layer/baseLayer.ts b/packages/boundary/src/layer/baseLayer.ts index 2719502f19..41edff174e 100644 --- a/packages/boundary/src/layer/baseLayer.ts +++ b/packages/boundary/src/layer/baseLayer.ts @@ -66,7 +66,7 @@ export default class BaseLayer extends EventEmitter { } public updateData( - newData: Array<{ [key: string]: any }>, + newData?: Array<{ [key: string]: any }>, joinByField?: [string, string], ) { this.setOption({ diff --git a/packages/boundary/src/layer/drillDown.ts b/packages/boundary/src/layer/drillDown.ts index ebad301273..07c08d68f4 100644 --- a/packages/boundary/src/layer/drillDown.ts +++ b/packages/boundary/src/layer/drillDown.ts @@ -62,6 +62,7 @@ export default class DrillDownLayer { } public addCountryEvent() { const { drillDownTriggerEvent } = this.options; + // 省级下钻到市 this.provinceLayer.fillLayer.on( drillDownTriggerEvent as string, (e: any) => { @@ -102,7 +103,7 @@ export default class DrillDownLayer { public showProvinceView( adcode: adcodeType, - newData: Array<{ [key: string]: any }> = [], + newData?: Array<{ [key: string]: any }>, joinByField?: [string, string], ) { this.cityLayer.show(); @@ -113,7 +114,7 @@ export default class DrillDownLayer { } public showCityView( code: adcodeType, - newData: Array<{ [key: string]: any }> = [], + newData?: Array<{ [key: string]: any }>, joinByField?: [string, string], ) { this.countyLayer.show(); @@ -149,7 +150,7 @@ export default class DrillDownLayer { } public drillDown( adcode: adcodeType, - newData: Array<{ [key: string]: any }> = [], + newData?: Array<{ [key: string]: any }>, joinByField?: [string, string], ) { const { drillDepth } = this.options; diff --git a/packages/boundary/src/layer/province.ts b/packages/boundary/src/layer/province.ts index baca6ddf53..afb636d14a 100644 --- a/packages/boundary/src/layer/province.ts +++ b/packages/boundary/src/layer/province.ts @@ -27,7 +27,7 @@ export default class ProvinceLayer extends BaseLayer { // 通过adcode 更新 public updateDistrict( adcode: adcodeType, - newData: Array<{ [key: string]: any }> = [], + newData?: Array<{ [key: string]: any }>, joinByField?: [string, string], ) { if (!adcode && Array.isArray(adcode) && adcode.length === 0) { diff --git a/stories/District/Layer/drillDown.tsx b/stories/District/Layer/drillDown.tsx index bceec23115..7f83e23639 100644 --- a/stories/District/Layer/drillDown.tsx +++ b/stories/District/Layer/drillDown.tsx @@ -32,6 +32,25 @@ export default class Country extends React.Component { this.drillDown = new DrillDownLayer(scene, { drillDepth: 2, geoDataLevel: 2, + joinBy: ['NAME_CHN', 'name'], + provinceData: [ + { + name: '青海省', + value: '1223', + }, + ], + cityData: [ + { + name: '海东市', + value: '1223e', + }, + ], + countyData: [ + { + name: '平安区', + value: '456', + }, + ], fill: { color: { field: 'NAME_CHN', @@ -51,7 +70,7 @@ export default class Country extends React.Component { popup: { enable: true, Html: (props) => { - return `${props.NAME_CHN}`; + return `${props.NAME_CHN} ${props.value}`; }, }, });