博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
asp.net core mvc 中在C# 代码中写 js 或html 文本
阅读量:7173 次
发布时间:2019-06-29

本文共 829 字,大约阅读时间需要 2 分钟。

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

转载于:https://www.cnblogs.com/LuoEast/p/9732291.html

你可能感兴趣的文章
使用自定义注解实现接口的参数校验
查看>>
Android 5.0+ 屏幕录制实现
查看>>
什么是智能指针?为什么要用智能指针?
查看>>
react-native
查看>>
Android之串口编程
查看>>
iOS逆向之旅(进阶篇) — HOOK(Logos)
查看>>
为什么Proxy可以优化vue的数据监听机制
查看>>
让eclipse像idea一样炫起来
查看>>
函数上下文 this 判断技巧。
查看>>
Flutter如何实现网易云音乐tabbar嵌套呢
查看>>
Flutter入门进阶之旅(一)-初识Flutter
查看>>
【设计模式】--可能是最详细的单例模式说明
查看>>
计算机组成原理-基本组成
查看>>
前端日刊君来也
查看>>
2019年Android岗位BAT等大厂面试题知识点小结
查看>>
java集合系列之18 spring boot程序员的必修课
查看>>
数据结构与算法-day1-复杂度分析(2)
查看>>
vue
查看>>
数字资产是二十一世纪数字经济下崭新的资产形态
查看>>
java数据结构
查看>>