mirror of https://gitee.com/antv-l7/antv-l7
parent
d07db2b7b7
commit
69835f79d6
|
@ -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({
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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 `<span>${props.NAME_CHN}</span>`;
|
||||
return `<span>${props.NAME_CHN} ${props.value}</span>`;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue