Google静态地图API与玉的动态链接

问题描述:

有没有办法让Google静态地图API链接在帕格(玉)模板中动态变化?Google静态地图API与玉的动态链接

例如,

img.img-responsive.img-rounded(src='http://maps.googleapis.com/maps/api/staticmap?center=52.241770, -0.900181&zoom=17&size=400x350&sensor=true&markers=52.241770, -0.900181&scale=2&key=API_KEY') 

的作品,但

img.img-responsive.img-rounded(src='http://maps.googleapis.com/maps/api/staticmap?center={location.coords.lng},{location.coords.lat}&zoom=17&size=400x350&sensor=true&markers={location.coords.lng},{location.coords.lat}&scale=2&key=API_KEY') 

没有。

如何使用引号?

img.img-responsive.img-rounded(src="http://maps.googleapis.com/maps/api/staticmap?center=" + location.coords.lng + "," + location.coords.lat + "&zoom=17&size=400x350&sensor=true&markers=" + location.coords.lng + "," + location.coords.lat + "&scale=2&key=API_KEY") 

试试template literal

img.img-responsive.img-rounded(src=`http://maps.googleapis.com/maps/api/staticmap?center=${location.coords.lng},${location.coords.lat}&zoom=17&size=400x350&sensor=true&markers=${location.coords.lng},${location.coords.lat}&scale=2&key=API_KEY`)