function getContextPath() {

    var pathName = document.location.pathname;
    var index = pathName.substr(1).indexOf("/");
    var result = pathName.substr(0,index+1);
    return result;

}


tips:

在一个使用layui.config的方法路径中写成'../../static/...',

当不加项目名启动war包时,显示正常,而加上项目名在测试环境下跑时就会报错

路径应该是’./static/...‘,表示从上往下寻找文件。

(开发环境跟测试环境还是有差别的,不能缺少测试环节)

 

相关文章:

  • 2022-12-23
  • 2021-12-05
  • 2021-12-26
  • 2022-01-07
  • 2022-12-23
  • 2021-12-26
  • 2022-12-23
  • 2021-08-02
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-11-04
  • 2021-12-05
  • 2021-07-10
相关资源
相似解决方案