如果是数组,则需要如下操作:
<script>var shopList = [];</script>
{% for shop in block %}
<script>shopList.push({
name:`{{ shop.settings.shop_name }}`,
lat:`{{ shop.settings.lat }}`,
long:`{{ shop.settings.long }}`,
icon:`{{ shop.settings.marker_img_url | img_url : 'master' }}`,
shop_id:`{{ shop.id }}`,
id: `{{ shop.id }}`,
shop_name:`{{ shop.settings.shop_name }}`,
shop_icon:`{{ shop.settings.shop_icon | img_url:'master' }}`,
daily:`{{ shop.settings.daily }}`,
address_icon:`{{ section.settings.address_icon | img_url:'master' }}`,
address_google_map_share_url:`{{ shop.settings.address_google_map_share_url }}`,
address:`{{ shop.settings.address }}`,
phone_icon:`{{ section.settings.phone_icon | img_url:'master' }}`,
phone:`{{ shop.settings.phone }}`,
link_products:`{{ shop.settings.link_products }}`,
shop_book_common_url:`{{ shop.settings.shop_book_common_url }}`,
book_btn_name:`{{ shop.settings.book_btn_name }}`,
street_long:`{{ shop.settings.street_long }}`,
street_lat:`{{ shop.settings.street_lat }}`,
street_pov: `{{ shop.settings.street_pov }}`,
street_view_btn_name: `{{ shop.settings.street_view_btn_name }}`,
is_test_ride: `{{ shop.settings.is_test_ride }}`
})</script>
{% endfor %}
<script>
var mapMarkerData = shopList;
</script>
如果不是对象,则直接如下操作即可
var mayLatlng = getLatLng(`{{ section.settings.first_lat`)}})