Skip to content

Commit

Permalink
fix:高德地图marker创建报错,无法显示问题
Browse files Browse the repository at this point in the history
  • Loading branch information
rainhon committed Nov 7, 2023
1 parent fc93239 commit 787a58b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions resources/views/form/map.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,13 +210,14 @@ function myFun() {
@endif
@if($type === 'amap')
function initAmap(){
var center = lng.val() && lat.val() ? [lng.val(), lat.val()] : null
var map = new AMap.Map(container[0], {
resizeEnable: true,
center: lng.val() && lat.val() ? [lng.val(), lat.val()] : null,
center: center,
zoom: 14
});
var marker = new AMap.Marker({
position: new AMap.LngLat(lng.val(), lat.val()),
position: center,
draggable: true,
map:map,
icon:'//a.amap.com/jsapi_demos/static/demo-center/icons/poi-marker-red.png',
Expand Down

0 comments on commit 787a58b

Please sign in to comment.