level 8
此ID已被我抢注
楼主
razor-tmpl 渲染 xxx.razor模板
npm安装npm install razor-tmpl
git 地址 code.csdn.net/magicdawn/razor-tmpl
使用
@(ViewBag.xxx)引用变量
@{} 来写代码块
@for(){} @while @if等
@@表示一个@
@include("a.razor")包含,跟ejs一样
在express中使用,关联后缀名
app.engine(".razor",require("razor-tmpl")._express);
例如在index渲染index.razor
app.get("/",function(req,res){
res.render("index.razor",{
hello : "hello razor-tmpl"
})
});
view\index.razor内容
<html>
<head>
<title>@(ViewBag.hello)</title>
</head>
<body>
@(ViewBag.hello)
</body>
</html>
2014年04月21日 02点04分
1
npm安装npm install razor-tmpl
git 地址 code.csdn.net/magicdawn/razor-tmpl
使用
@(ViewBag.xxx)引用变量
@{} 来写代码块
@for(){} @while @if等
@@表示一个@
@include("a.razor")包含,跟ejs一样
在express中使用,关联后缀名
app.engine(".razor",require("razor-tmpl")._express);
例如在index渲染index.razor
app.get("/",function(req,res){
res.render("index.razor",{
hello : "hello razor-tmpl"
})
});
view\index.razor内容
<html>
<head>
<title>@(ViewBag.hello)</title>
</head>
<body>
@(ViewBag.hello)
</body>
</html>