且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将Razor变量转换为Javascript

更新时间:2023-02-16 21:22:25

如果需要将变量设置为字符串文字,则需要将其用引号引起来.例如:

If you need to set a variable to a string literal, then it needs to be enclosed in quotes. For example:

<script>
   var test1 = '@Model.testVariable';
</script>