Skip to content

Latest commit

 

History

History
46 lines (35 loc) · 1.03 KB

README.md

File metadata and controls

46 lines (35 loc) · 1.03 KB

City Selector Control

Adds a City Selector Control to mapbox-gl

Installation:

npm i cityselector-control

Usage:

new CitySelectorControl(options: Object)

Options:

# Name Type Description Default
1 theme String Theme, optional 'light' or 'dark'. 'light'
2 placeholder String The initialized text. default '请选择'
2 hot Array The Code for hot cities. default ['440100', '440300', '330100', '510100']
2 zoom Number The desired zoom level. default 10

Example

import CitySelectorControl from 'cityselector-control'
import 'cityselector-control/src/style.css'
// default options
map.addControl(new CitySelectorControl(), 'top-right')

// custom options
const citySelectorOptions = {
  theme: 'dark',
  placeholder: '全国',
  hot: ['110000', '340500'],
  zoom: 10
};
map.addControl(new CitySelectorControl(citySelectorOptions), 'top-right');

Screenshots:

theme default