代码拉取完成,页面将自动刷新
Ego 是一个基于 Gin 用 Go 编写的全栈 Web 框架,轻量级和高效的前端组件解决方案. 前端编译执行,不影响后端效率.
这是一项正在完善的工作.
Go Version ≥1.7
go get github.com/go-ego/ego
go get -u github.com/go-ego/ego
go get -u github.com/go-ego/re
创建一个新的 Ego web 项目
$ re new my-webapp
运行我们创建的 web 项目, 你可以导航到应用程序文件夹并执行:
$ cd my-webapp && re run
package main
import (
"github.com/go-ego/ego"
)
func main() {
router := ego.Classic()
ego.UseRenders()
router.GlobHTML("views/html/*")
parArr := [5]int{1, 2, 3, 4, 5}
router.Ego("/head/", "head/head.html", ego.Map{
"head": "Test to load the HTML template",
"parArr": parArr,
})
router.Run(":3100")
}
// pkg icon
<div class="icon">
<i class="iconfont {vclass}" {node}></i>
<p>{prpo}</p>
</div>
<style>
.header-left{
float:left;
}
.header-right{
float:right;
}
.iconfont {
position: relative;
font-size:24px
}
</style>
import (
"icons"
icon "icons/icon.vgo"
)
<div class="head">
<div>ego:{{.head}}</div>
<icon>
vclass={icon-share-to}
node={ id="slot1"}
prpo={node---1}
</icon>
<div>
{{range .parArr}}
<p>arr::: {{.}}</p>
{{end}}
</div>
</div>
package main
import (
"github.com/go-ego/ego"
)
const httpUrl string = "http://127.0.0.1:3000"
func main() {
router := ego.Classic()
router.Static("/js", "./views/js")
router.Static("/src", "./views/src")
router.GlobHTML("views/html/*")
strUrl := httpUrl + "/test/hlist"
paramMap := ego.Map{
"lon": "10.1010101",
"lat": "20.202020",
"type": "1",
}
router.TestHtml(strUrl, paramMap) // http url, http 参数, args (可选参数): 默认为 "data"
router.Run(":3100")
}
To contribute to Ego, please see Contribution Guidelines. Fork -> Patch -> Push -> Test -> Pull Request.
See contributors page for full list of contributors.
Ego is primarily distributed under the terms of both the MIT license and the Apache License (Version 2.0), with portions covered by various BSD-like licenses.
See LICENSE-APACHE, LICENSE-MIT, and COPYRIGHT for details.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
1. 开源生态
2. 协作、人、软件
3. 评估模型