beego快速体验
作者:互联网
beego快速体验
- 修改controllers/default.go
func (c *MainController) Get() {
c.Data["Website"] = "beego.me"
c.Data["Email"] = "astaxie@gmail.com"
//c.TplName = "index.tpl"
c.TplName = "test.html"
}
- 在views/文件夹下新建test.html,在body中添加内容
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
</head>
<body>
<h1>hello world</h1>
<h1>{{.Email}}</h1>
</body>
</html>
- 可以看到成功修改bee run默认打开的页面
标签:beego,Data,TplName,html,体验,test,快速,Email 来源: https://blog.csdn.net/qq_44140067/article/details/122165003