VueRouterApi
This is the API for the frontend router.
1. VueRouterApi Methods
RegisterPortalRoutes
This method is used to register the portal routes. It is a variadic function that accepts multiple instances of sdkhttp.VuePortalRoute
.
api.Http().VueRouter().RegisterPortalRoutes(sdkhttp.VuePortalRoute{
RouteName: "insert-coin",
RoutePath: "/coinslot/:id/insert-coin",
Component: "InsertCoin.vue",
HandlerFunc: func (w http.ResponseWriter, r *http.Request) {
// Do something
},
})
RegisterAdminRoutes
This method is used to register the admin routes. It is a variadic function that accepts multiple instances of sdkhttp.VueAdminRoute
.
api.Http().VueRouter().RegisterAdminRoutes(sdkhttp.VueAdminRoute{
RouteName: "admin-dashboard",
RoutePath: "/admin/dashboard",
Component: "AdminDashboard.vue",
HandlerFunc: func (w http.ResponseWriter, r *http.Request) {
// Do something
},
})
PortalItemsFunc
This method is used to show items in the captive portal.
The items are a slice of sdkhttp.VuePortalItem
.
This function is called every time the captive portal is loaded.
See Portal Items for example.
AdminNavsFunc
This method is used to add items to the admin navigation.
The items are a slice of sdkhttp.VueAdminNav
.
See Admin Navs for examples.
VueRouteName
This method returns the vue route name that can be used for router-link
vue component:
VueRoutePath
This method returns the vue route path that can be used for router-link
vue component:
VuePkgRoutePath
This method returns the vue route path from third-party plugins that you can use on your own plugin.
data := map[string]string{
"VueRoutePath": api.Http().VueRouter().VuePkgRoutePath("com.third-party.plugin", "third-party-route"),
}
2. PortalRoute
A portal route is an instance of sdkhttp.VuePortalRoute
that is used to register portal routes.
See Portal Routes.
3. AdminRoute
An admin route is an instance of sdkhttp.VueAdminRoute
that is used to register admin routes.
See Admin Routes.