2016-04-22 52 views

回答

2

您可以使用此plugin here。詳細documentation顯示使用率

安裝:

Grails的安裝,插件Groovy的麪包屑,插件

使用:

麪包屑插件是基於MenuDefinitionService是由應用程序提供。所以,讓我們創建服務

運行創建服務MenuDefinitionService

在MenuDefinitionService創建一個名爲loadMenuDefinition

例如

方法
class MenuDefinitionService { 

    static transactional = false 

    static scope = "session" 

    static proxy = true 


    def loadMenuDefinition() { 
     def menus = [] 

     menus << new MenuItem(name : "page-one", message:"page.one.demo", controller: "BreadCrumbsDemo", action: "pageOne") 
     MenuItem menuThreeTwo = new MenuItem(name : "page-two-", message:"page.two.demo", controller: "BreadCrumbsDemo", action:"pageThreeTwo") 
     menuThreeTwo << new MenuItem(name : "page-two.one", message:"page.two.one.demo", controller: "BreadCrumbsDemo", action:"pageThreeTwoOne") 
     menuThreeTwo << new MenuItem(name : "page-two.two", message:"pagetwo.two.demo", controller: "BreadCrumbsDemo", action:"pageThreeTwoTwo") 
     menus << menuThreeTwo 

     menus 
    } 
} 

可以定義你想要的水平!