承接 flaviovs/yii2-geocomplete 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

flaviovs/yii2-geocomplete

Composer 安装命令:

composer require flaviovs/yii2-geocomplete

包简介

jQuery Geocomplete widget for Yii2

README 文档

README

A geocomplete widget for Yii2 using the Geocomplete jQuery plugin.

Usage

First you need to configure Google Maps API key, This can be done by setting the mapsApiKey property in the widget's asset bundle in your app config:

'components' => [
    'assetManager' => [
        'bundles' => [
            fv\yii\geocomplete\Asset::class => [
                'mapsApiKey' => 'YOUR-API-KEY',
			]
		]
	]
];

You can use sessionToken on the asset bundle configuration to specify the session token to be sent to Maps API (see details here). The extension will generate a session token by default -- set this parameter to false to prevent this.

Notice The widget will not work properly unless you provide a valid API key. See https://developers.google.com/maps/documentation/javascript/get-api-key for more details.

Then you can add geocomplete widgets to your models fields in your views:

<?= $form->field($model, 'address')
         ->widget(\fv\yii\geocomplete\Widget::class) ?>

Yii2 Geocomplete configure the jQuery plugin to look for the data-geocomplete attribute when address lookup is complete. This makes easy to get other values from the address. For example, to get the country code and postal code in separate fields, use the following code:

<?= $form->field($model, 'address')
     ->widget(\fv\yii\geocomplete\Widget::class) ?>

<?= $form->field($model,
                 'postal_code', [
                     'inputOptions' => [
                         'data-geocomplete' => 'postal_code',
                     ],
                 ]) ?>

<?= $form->field($model,
                 'country_code', [
    	             'inputOptions' => [
                         'data-geocomplete' => 'country_short',
                     ],
                 ]) ?>

Widget Options

Yii2 Geocomplete widgets accept the following options:

  • options - standard tag attributes

  • container - jQuery selector of HTML container that Yii2 Geocomplete should look for data-geocomplete-tagged elements. Default is the parent form (obtained from Javascript).

  • geocompleteOptions - object with Geocomplete plugin options. See https://ubilabs.github.io/geocomplete/ for a complete list.

Issues

Visit: https://github.com/flaviovs/yii2-geocomplete

统计信息

  • 总下载量: 1.34k
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2018-11-14

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固