尝试生成
map_blue_1.png
,
map_blue_2.png
,等等,但在
{i+1}
. 正确的方法是什么?
<% content_for :in_script do %>
$("#map").gMap({
markers: [
<% @spots.each_with_index do |spot, i| %>
<% if spot.geocoded? %>
{
latitude: <%= spot.lat %>,
longitude: <%= spot.lng %>,
html: "<a href='#item_<%= i + 1 %>'><strong><%=h spot.name %></strong></a>",
icon: { image: "<%= APP_CONFIG[:site_url] + '/images/map_blue_' + {i+1} + '.png' %>",
iconsize: [48, 48],
iconanchor: [24,48],
infowindowanchor: [24, 0] }
},
<% end %>
<% end %>
],
zoom: 12 });
<% end %>