我有很多记录,我想以模式的形式打开它们的位置,但是我一直坚持如何将动态的Lat-Lng值传递给模式。>
我想打开这样的地图,但每个[[map
按钮上的地图都是动态的]请在每个地图按钮上建议我该如何做...
@foreach($toilets as $toilet)
<tr>
<th scope="row">{{ $toilet->id }}</th>
<td title="{{ $toilet->owner['email'] }}">
{{ $toilet->owner['id'] }}
</td>
<td>{{ $toilet->toilet_name }}</td>
<td><b>${{ $toilet->price }}</b></td>
<td>{{ $toilet->complex_name }}</td>
<td>{{ $toilet->address.$toilet->getFullAddress() }}</td>
<td>
@if($toilet->status==1) <f class="text-success">Active</f>
@else <f class="text-warning">Not Active</f> @endif
</td>
<td>
{{ $toilet->created_at->format('d/m/Y').' at '.$toilet->created_at->format('g:i A') }}
</td>
<td>
<button class="btn btn-success" class="btn btn-primary"
data-toggle="modal" data-target="{{$toilet->toilet_lat . $toilet->toilet_lng}}">
Map
</button>
</td>
</tr>
@endforeach
但是如何在js变量中获取它
var myLatLng = {
lat: ??,
lng: ??
};
function myMap() {
var mapProp= {
center: myLatLng,
zoom:15,
gestureHandling: 'greedy'
};
var map = new google.maps.Map(document.getElementById("map"),mapProp);
placeMarker(map, myLatLng);
google.maps.event.addListener(map, 'click', function(event) {
placeMarker(map, event.latLng);
});
}
我有很多记录,我想在模式中打开它们的位置,但是我一直坚持如何将动态Lat-Lng值传递给模式,我想像这样打开地图,但是在每个地图按钮上都是动态的...] >
<button type="button" data-lat="10.2232" data-lng="16.0232">Map</button>