權限管理系統之SpringBoot集成LayUI實現後臺管理首頁

萬事開頭難,昨天一直在構思用戶權限管理系統怎麼實現,實現哪些需求,採用什麼技術等,也在網上百度了好多,計劃使用SpringBoot + Mybatis + thymeleaf  + LayUI + Shiro等相關技術來實現,昨天新建了一個SpringBoot的項目,想着先使用LayUI實現左側導航欄右側上面Tab選項下面顯示內容的系統首頁,因爲以前也沒用過LayUI框架,昨天搞到2點多也沒搞出來,今天偶然間找到了layTabPlus插件,該插件是一個layUI後臺Tab佈局框架的擴展插件,實現了Tab管理、刷新按鈕、iframe優化等功能,很是好用,今天把layTabPlus插件集成到了SpringBoot項目中。html

1、下載插件git

須要下載兩個插件,LayUI插件和layTabPlus插件,layTabPlus插件:https://gitee.com/Leytton/layTabPlus。web

2、新建SpringBoot項目spring

新建項目時選擇Web和thymeleaf 模塊,這樣項目的pom.xml中會引入spring-boot-starter-thymeleaf來自動集成thymeleaf。瀏覽器

3、將LayUI、layTabPlus拷貝到項目中app

將在第一步下載的兩個插件放到項目的資源包resources下,把layTabPlus插件中的index.html頁面內容放到templates下,這裏index.html用做了歡迎頁面,因此使用了home.html。框架

4、建立Controlleride

這裏在com.example.Controller包下建立了HomeController用來測試home.html。spring-boot

package com.example.Controller; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @Controller @RequestMapping("/home") public class HomeController { @RequestMapping(value = "/home",method = RequestMethod.GET) public String hello(Model model) { return "home"; } }
View Code

這裏還不能忘了在main類中加上一句掃描包,否則會報404錯誤。佈局

@ComponentScan(basePackages = {"com.example.*"})

5、啓動項目,瀏覽器輸入http://localhost:8080/home/home

6、小結

目前把首頁作出來了,後續就是在此基礎上集成Mybatis、日誌等模塊,實現頁面的增刪改查功能。

 

原文出處:https://www.cnblogs.com/5ishare/p/10420026.html

相關文章
相關標籤/搜索