【问题标题】:How to link to my root_path plus an anchor using HAML如何使用 HAML 链接到我的 root_path 和锚点
【发布时间】:2018-04-05 15:15:25
【问题描述】:

我有这个使用haml的sn-p代码

%li.tab.col.s3.l2
  %a{:href => "#main_kpis"} KPIs
 #main_kpis.col.s12.no-padding
  .col.s12.light-sky-grid
    #kpis_wrapper

当我点击 li>tab 元素时,我直接进入了 div main_kpis,但是我需要将完整的 URL 发送到浏览器......我该怎么做?

【问题讨论】:

  • 什么的完整 URL?当前页面?
  • 是的,到同一个页面,我只需要链接将他的锚点添加到 url..

标签: ruby-on-rails ruby haml


【解决方案1】:
%li.tab.col.s3.l2
  = link_to("KPIs", root_url(anchor: '#main_kpis'))
  #main_kpis.col.s12.no-padding
    .col.s12.light-sky-grid
      #kpis_wrapper

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2014-11-11
  • 2020-09-06
  • 1970-01-01
  • 1970-01-01
  • 2011-10-05
  • 2019-12-17
  • 1970-01-01
  • 2020-05-29
相关资源
最近更新 更多