Skip to content

Portal Items

Portal items are the items displayed in the captive portal.

TODO: add image here

A portal item is just a link to an existing portal route. Therefore, to display an item in the captive portal, one must already have defined a portal route.

To register a portal item to be displayed in the captive portal, we will use the VueRouterApi.PortalItemsFunc method:

api.Http().VueRouter().PortalItemsFunc(func(clnt sdkconnmgr.ClientDevice) []sdkhttp.VuePortalItem {
    portalItem := sdkhttp.VuePortalItem{
        Label:       "Welcome",
        IconPath:    "icons/welcome.png",
        RouteName:   "portal.welcome",
        RouteParams: map[string]string{"name": "Jhon"},
    }
    return []sdkhttp.VuePortalItem{portalItem}
})

A portal item is defined by the following fields:

Label (required)
This is the text label that will be displayed in the captive portal.
IconPath (required)
This is the path to the icon image that will be displayed next to the label. Icon paths are searched in resources/assets directory.
RouteName (required)
This is the route name field of the portal route that the item will link to.
RouteParams (optional)
This is a map of parameters that will be passed to the portal route to form the link.