https://blog.csdn.net/orichisonic/article/details/62046621
使用<text>這個偽元素來強制Razor從編譯模式返回到內容模式:
@foreach (
var
item
in
Model) {
<text>
var
markerlatLng =
new
google.maps.LatLng(@(Model.Latitude), @(Model.Longitude));
var
title =
'@(Model.Title)'
;
var
description =
'@(Model.Description)'
;
var
contentString =
'<h3>'
+ title +
'</h3>'
+
'<p>'
+ description +
'</p>'
var
infowindow =
new
google.maps.InfoWindow({
content: contentString
});
var
marker =
new
google.maps.Marker({
position: latLng,
title: title,
map: map,
draggable:
false
});
google.maps.event.addListener(marker,
'click'
,
function
() {
infowindow.open(map, marker);
});
</text>
}
</script>
--------------------- 本文來自 藍色水 的CSDN 博客 ,全文地址請點擊:https://blog.csdn.net/orichisonic/article/details/62046621?utm_source=copy