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 @ 2022-01-10 15:36  KeyG  阅读(281)  评论(0)    收藏  举报