layui菜单请求地址栏双杠问题

在初始化文件init.json中href去掉/发现运行后404

复制代码
{
"title": "用户维护",
"href": "usergl/tolist",
"icon": "fa fa-home",
"target": "_self",
"child": [
{
"title": "用户添加",
"href": "usergl/toadd",
"icon": "fa fa-tachometer",
"target": "_self"
}
]
复制代码

 

无奈只能加上,但加上地址栏会有双杠 #//  出现

 

如http://localhost:8001/houtai#//bookgl/tolist

 

查找很久发现是与控制器路径有关

 

复制代码
@Controller
@RequestMapping("/houtai")
public class BaseController { @RequestMapping("/index")//基础路径 public String houtai(){ return "houtai/index"; } @RequestMapping("/welcome")//欢迎页 public String welcome(){ return "welcome"; } }
复制代码

上面那样会出现// 现象,与写了总路径有关,但具体原因猜测和layuimini有关

改成下面这样问题终于解决

复制代码
@Controller
public class BaseController {

    @RequestMapping("/houtai")//基础路径
    public String houtai(){
        return "houtai/index";
    }

    @RequestMapping("/welcome")//欢迎页
    public String welcome(){
        return "welcome";
    }

}
复制代码

 

@RequestMapping("/houtai")
posted @   KeyG  阅读(267)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· 没有Manus邀请码?试试免邀请码的MGX或者开源的OpenManus吧
点击右上角即可分享
微信分享提示