Reference Source
public class | source

MapInput

Extends:

leaflet~L.Control.MapInput → MapInput

用于创建地图上的输入控件

Example:

var options = {
  position: 'topleft',

  onClick: function () {
    console.log('onclick!!!');
    console.log(this.value());
  },
}
var input = new KQ.Control.MapInput(options);
input.setDropdownData([ 'A', 'B', 'C' ]);
input.setOnClick(function () {
  console.log('new onclick!!!');
  console.log(input.value());
  console.log(input.dropdownValue());
});

Constructor Summary

Public Constructor
public

constructor(options: Object)

构造函数

Method Summary

Public Methods
public

addToMapView(mapview: MapView): Null

添加控件到地图

public

返回下拉框的值

public

remove(): Null

从地图上移除控件

public

setOnClick(callback: function(e: Object): null): Null

设置按钮点击时的回调函数

public

返回输入框的值

Public Constructors

public constructor(options: Object) source

构造函数

Params:

NameTypeAttributeDescription
options Object

设置参数

options.position String

输入框的位置,如:“topleft”

options.iconType String

图标类型,默认是“search”,可选('check', 'custom', 'play', 'heart')

options.inputWidth Number

输入控件的宽度

options.isHasDropdown Boolean

如果值为false,下拉选择框控件将不显示

options.dropdownWidth Number

下拉选择框控件的宽度

options.dropdownMargin Number

输入控件与下拉选择框控件的间隔

options.onClick Object

按钮点击时的响应函数

Public Methods

public addToMapView(mapview: MapView): Null source

添加控件到地图

Params:

NameTypeAttributeDescription
mapview MapView

mapview对象

Return:

Null

public dropdownValue(): String source

返回下拉框的值

Return:

String

public remove(): Null source

从地图上移除控件

Return:

Null

public setOnClick(callback: function(e: Object): null): Null source

设置按钮点击时的回调函数

Params:

NameTypeAttributeDescription
callback function(e: Object): null

点击事件的响应函数

Return:

Null

public value(): String source

返回输入框的值

Return:

String