Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/laravel-admin-extensions/tencent-map
https://github.com/laravel-admin-extensions/tencent-map
Last synced: 6 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/laravel-admin-extensions/tencent-map
- Owner: laravel-admin-extensions
- License: mit
- Created: 2019-02-27T05:24:34.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-10-29T02:46:23.000Z (about 4 years ago)
- Last Synced: 2024-09-29T05:51:07.596Z (about 1 month ago)
- Language: PHP
- Size: 7.81 KB
- Stars: 15
- Watchers: 2
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-laravel-admin - tencent-map - 带搜索功能的腾讯地图组件 (扩展包 / 字段类扩展包)
README
# Tencent Map with search for Laravel-admin
这个扩展用来帮助你在 form 表单中通过使用腾讯地图搜索地址和点击地图来获取经纬度。
## 截图
## 安装
```bash
composer require jxlwqq/tencent-map
```## 配置
打开config/admin.php,按照你的情况在extensions部分加上如下的配置:
```
'extensions' => [
'tencent-map' => [
'enable' => true,
'api_key' => env('TENCENT_MAP_API_KEY')
]
]
```api_key 在 [腾讯位置服务控制台 -> key管理](https://lbs.qq.com/dev/console/key/manage) 创建。
## 使用
假设你的表中有两个字段`latitude`和`longitude`分别表示纬度和经度,那么在表单中使用如下:
```php
$form->tencentMap('latitude', 'longitude', '经纬度');// 设置地图高度
$form->tencentMap('latitude', 'longitude', '经纬度')->height(500);// 设置地图缩放
$form->tencentMap('latitude', 'longitude', '经纬度')->zoom(13);// 设置默认值
$form->tencentMap('latitude', 'longitude', '经纬度')->default(['lat' => 90, 'lng' => 90]);
```## License
Licensed under [The MIT License (MIT)](LICENSE).