link_to 在 HAML 中的 Foundation 垂直导航栏中

link_to in Foundation vertical navbar in HAML

如何将 link_to 重定向到此 HAML 代码中的 root_path?

    .icon-bar.large.vertical.four-up
     %a.item
      %img{:src => "/svgs/fi-home.svg"}/
      %label Home

快速 google 搜索让我找到了这个,https://rivalfox.com/blog/haml-best-practices/

所以我会尝试以下方法,

= link_to root_path, class: ['btn', 'btn-default'] do
  = image_tag 'fi-home.svg'
  Home
 .icon-bar.large.vertical.four-up
   = link_to root_path, class: ['item'] do
   = image_tag "/svgs/fi-home.svg"
   %label Home

这有效,感谢您的帮助。