-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.go
43 lines (37 loc) · 1 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package main
import (
"log"
)
// cd example/helloworld
// exec `go-vue-ssr -src=./vue -to=./ -pkg=main -watch` before run main
func main() {
c := NewRenderCreator()
r := c.NewRender()
w := r.NewWriter()
r.Render("page", w, &Options{
Props: map[string]interface{}{
"title": "go-vue-ssr",
"slogan": "Hey vue go",
"info": map[string]interface{}{
"author": "bysir",
"Hey vue go": "Hey vue go",
},
"logo": "https://avatars2.githubusercontent.com/u/13434040?s=88&v=4",
"height": 100.1,
},
})
log.Print(w.Result())
// will print like following code(formatted):
// <html lang="zh">
// <head>
// <meta charset="UTF-8"></meta>
// <title>go-vue-ssr</title>
// </head>
// <body><h1>go-vue-ssr</h1>
// <div style="margin-bottom: 10px; padding: 40px; text-align: center;">
// <p style="padding: 10px 0; ">Hey vue go</p>
// <img alt="todo logo" height="50px" src="https://avatars2.githubusercontent.com/u/13434040?s=88&v=4"></img>
// </div>
// </body>
// </html>
}