nkizza/yii2-map-pick
Composer 安装命令:
composer require nkizza/yii2-map-pick
包简介
Coordinates picker widget for Yii2.
关键字:
README 文档
README
A map picker for latitude, longtitude and zoom attributes of the model. This widget uses (Yandex.Maps)[http://maps.yandex.ru] API. Fill three important location attributes with one click! Requires jQuery.
Installation
The preferred way to install this extension is through composer.
Either run composer require nkizza/yii2-map-pick:~1.0 or add nkizza/yii2-map_pick:~1.0 to the require section of your application's composer.json file.
Usage
The widget provides three available values: latitude, longtitude and zoom. The complete definition of the field is:
<?= MapPick::widget([
...
'attributes' => [ //key - must be a "zoom", "lat" or "lon"
'zoom' => [
'name'=>'MapsCoords[zoom]', //input name (may be custom)
'value'=>7, //initial value for input
]
],
]);?>
You may define only needed attributes. Please refer to the following code to see the examples:
<?= MapPick::widget([
'model'=>$model,
//html options for the container tag
'options'=>[
'style'=>'height:400px',
],
//model attributes
'attributes' => [
'lat', //latitude (your model must have the 'lat' field)
'lon'=>'longtitude', // your model has the 'longtitude' field, place it under the key 'lon')
'zoom' => [
'name'=>'MapsCoords[customzoom]', //custom input name for attribute (if needed)
'value'=>7, //initial value for input
]
],
//custom js callback, is optional
'callback' => 'function(lat, lon, zoom) {alert('Hello!');}',
//language identifier
'language' => 'en_US',
]);?>
统计信息
- 总下载量: 580
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 4
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2016-10-21