@bdh-gis/ol-control-baselayer
v1.5.1
Published
Baselayer for ol controls
Downloads
102
Readme
🏷️ @bdh-gis/ol-control-baselayer
底图切换
npm i @bdh-gis/ol-control-baselayer
//底图切换组件
import Baselayer from '@bdh-gis/ol-control-baselayer';
// import '@bdh-gis/ol-control-baselayer/src/index.css';
import '@bdh-gis/ol-control-baselayer/src/dark.css';
/*************************** 底图切换 ****************************/
const baselayer = new Baselayer({
isCreateButtons: true,
onEvents: (type, data) => {
console.log(type, data);
},
});
map.addControl(baselayer);
Options
export type AnyEvent = "CONTROL_BUTTON_CLICK" | "CREATE_BUTTONS" | "CREATE_PANEL" | "UPDATE_PANEL" | "PANEL_OPEN" | "PANEL_CLOSE" | "BASELAYER_SWITCH";
export type Panel = {
header?: HTMLDivElement;
headerTitle?: HTMLDivElement;
headerClose?: HTMLDivElement;
body?: HTMLDivElement;
bodyImgs?: {
wrapperEl: HTMLDivElement;
imgEl: HTMLDivElement;
labelEl: HTMLDivElement;
deleteEl?: HTMLDivElement;
}[];
};
export type Options = {
isCreateButtons?: boolean;
isCreatePanel?: boolean;
buttons?: Utils.ButtonOptions[];
panelContainer?: HTMLDivElement;
onEvents?: (event: AnyEvent, data?: any) => void;
};