menu

package
v0.0.0-...-6264292 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 29, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init

func Init(dir string)

Types

type Info

type Info struct {
	Current    *Node
	TopMenus   []*Node
	LeftMenus  []*Node
	Breadcrumb []*Node
}

Info 菜单信息

func (*Info) IsActive

func (n *Info) IsActive(m *Node) bool

IsActive 是否选中

type Menu struct {
	Items []*Node `json:"items" xml:"item"`
	// contains filtered or unexported fields
}

Menu 菜单信息

func Get

func Get() *Menu
func (m *Menu) GetInfo(url string) (mi *Info)

GetInfo 获取当前请求地址对应的菜单信息

type Node

type Node struct {
	ID           string
	Level        int
	Parent       *Node
	VisibleItems []*Node
	Name         string  `json:"name" xml:"name,attr"`
	URL          string  `json:"url" xml:"url,attr"`
	Hidden       bool    `json:"hidden" xml:"hidden,attr"`
	Items        []*Node `json:"items" xml:"item"`
}

Node 菜单项信息

func (*Node) GetTop

func (n *Node) GetTop() *Node

GetTop 获取顶级菜单

func (*Node) SetID

func (n *Node) SetID(sn int)

SetID 设置菜单项 ID

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL