这可能是一个javascript问题,但由于它还处理Rails变量和gmpas4rails gem我还是想问你...
我认为这是
<%= gmaps(
{
"markers" => { "data" => @json },
"circles" => { "data" => '[
{"lng": 122.214897, "lat": 37.772323, "radius": 25000, "strokeColor": "#FF0000"}
]',
},
}
) %>
我有圈子的部分我想要这个
"circles" => { "data" => '[
{"lng": '@shop.longitude', "lat": '@shop.latitude', "radius": 25000, "strokeColor": "#FF0000"}
因此,对于每个商店,它都会将圆圈居中并绘制区域......
答案 0 :(得分:1)
你不应该逃避纬度和经度:
"circles" => {
"data" => "[{'lng': #{@shop.longitude}, 'lat': #{@shop.latitude}, 'radius': 25000, 'strokeColor': '#FF0000'}]"
}
替代解决方案:
"circles" => {
"data" => [{'lng' => @shop.longitude, 'lat' => @shop.latitude, 'radius' => 25000, 'strokeColor' => '#FF0000'}].to_json
}