douzai6337 2019-03-15 10:07
浏览 260

在Beego中像子目录一样进行路由

As of now i am routing like the following:

beego.Router("/detailed", &controllers.MainController{}, "get:Detailed")

Instead i want to route like this:

beego.Router("/detailed/[some-product-name]", &controllers.MainController{}, "get:Detailed")

i did try like below:

beego.Router("/detailed/:id", &controllers.MainController{}, "get:Detailed")

But all dependency files like js, bootstrap, css are expected in the path of /detailed/static/ instead of /static.

Thank you.

  • 写回答

1条回答 默认 最新

  • dongzhang5787 2019-03-15 11:55
    关注

    It's not a beego problem. You probably made your include scripts, stylesheets link relative. In your html (template), all file "improts" you should predate with / sign. So if you have

    <script src="static/js/jquery.js" type="text/javascript"></script>

    You need to change it to:

    <script src="/static/js/jquery.js" type="text/javascript"></script>

    评论

报告相同问题?

悬赏问题

  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 matlab有关常微分方程的问题求解决
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误
  • ¥199 rust编程架构设计的方案 有偿
  • ¥15 回答4f系统的像差计算
  • ¥15 java如何提取出pdf里的文字?
  • ¥100 求三轴之间相互配合画圆以及直线的算法
  • ¥100 c语言,请帮蒟蒻写一个题的范例作参考