cg33 vor 6 Jahren
Ursprung
Commit
87994aea1a
2 geänderte Dateien mit 3 neuen und 6 gelöschten Zeilen
  1. 2 1
      index.go
  2. 1 5
      main.go

+ 2 - 1
index.go

@@ -1,6 +1,7 @@
 package main
 
 import (
+	"github.com/GoAdminGroup/go-admin/context"
 	tmpl "github.com/GoAdminGroup/go-admin/template"
 	"github.com/GoAdminGroup/go-admin/template/chartjs"
 	"github.com/GoAdminGroup/go-admin/template/icon"
@@ -15,7 +16,7 @@ import (
 )
 
 // GetContent return the content of index page.
-func DashboardPage() (types.Panel, error) {
+func DashboardPage(ctx *context.Context) (types.Panel, error) {
 
 	components := tmpl.Default()
 	colComp := components.Col()

+ 1 - 5
main.go

@@ -6,11 +6,9 @@ import (
 	_ "github.com/GoAdminGroup/themes/adminlte"                    // theme
 
 	"github.com/GoAdminGroup/example/tables"
-	"github.com/GoAdminGroup/go-admin/context"
 	"github.com/GoAdminGroup/go-admin/engine"
 	"github.com/GoAdminGroup/go-admin/template"
 	"github.com/GoAdminGroup/go-admin/template/chartjs"
-	"github.com/GoAdminGroup/go-admin/template/types"
 	"github.com/gin-gonic/gin"
 	"io/ioutil"
 )
@@ -69,9 +67,7 @@ func main() {
 	// customize your index pages
 	// 下面这样定制您的首页👇
 
-	eng.HTML("GET", "/admin", func(ctx *context.Context) (panel types.Panel, e error) {
-		return DashboardPage()
-	})
+	eng.HTML("GET", "/admin", DashboardPage)
 
 	_ = r.Run(":9033")
 }