python222网站实战(SpringBoot+SpringSecurity+MybatisPlus+thymeleaf+layui)-主页设计Menu动态菜单模块实现

锋哥原创的Springboot+Layui python222网站实战:

python222网站实战课程视频教程(SpringBoot+Python爬虫实战) ( 火爆连载更新中... )_哔哩哔哩_bilibilipython222网站实战课程视频教程(SpringBoot+Python爬虫实战) ( 火爆连载更新中... )共计23条视频,包括:python222网站实战课程视频教程(SpringBoot+Python爬虫实战) ( 火爆连载更新中... )、第2讲 架构搭建实现、第3讲 页面系统属性动态化设计实现等,UP主更多精彩视频,请关注UP账号。icon-default.png?t=N7T8https://www.bilibili.com/video/BV1yX4y1a7qM/新建t_menu表

CREATE TABLE `t_menu` (
  `id` INT(11) NOT NULL AUTO_INCREMENT,
  `name` VARCHAR(20) DEFAULT NULL,
  `url` VARCHAR(500) DEFAULT NULL,
  `color` VARCHAR(20) DEFAULT NULL,
  `strong` BIT(1) DEFAULT b'0',
  `sort` INT(11) DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=INNODB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8;

/*Data for the table `t_menu` */

INSERT  INTO `t_menu`(`id`,`name`,`url`,`color`,`strong`,`sort`) VALUES (1,'首页','/','black','',1),(2,'课程','/course/list','black','',2),(3,'Java全栈学习路线图','/article/1','black','',3),(6,'关于锋哥','/article/14','#e11717','',6),(9,'java1234门徒服务','/article/5','#000000','',5),(11,'VIP活动特价','http://www.java1234.com/vip.html','#f50606','',4);

通过MybatisX插件生成代码

缓存里获取menuList

common下面新建menu.html

<meta charset="UTF-8">

<div id="m">
    <a href="/" class="logo" ></a>

    <ul class="nav">
        <li th:each="menu:${application.menuList}"><a th:href="${menu.url}" th:style="'color:'+${menu.color}+';font-weight:'+${menu.strong==true?'bold':'normal'}" th:text="${menu.name}"></a></li>
    </ul>

    <div class="searchAndLogin">
        <div class="search d7">
            <form action="/search/1" method="post">
                <input  type="text" name="keyWord" placeholder="搜索从这里开始..." autocomplete="off" >
                <button type="submit"></button>
            </form>
        </div>
    </div>

</div>