链接在翻译成 slim 格式后不起作用

Links do not work after translation into slim format

我有一个 html 代码 rails。我需要将它翻译成 slim 格式,我更改了文件格式,用对流器翻译并尝试 运行 结果链接不起作用,你能告诉我为什么吗?

head.html.erb

<section id="header">
  <div class='navigation-panel'>
    <button class='burger-button' id='header-burger-button container'  onclick='burgerAction()'>
      <%= image_tag("header/burger.png") %>
    </button>
    <button class='contact-us-button burger-hidable container' onclick='scroller("contact")'> CONTACT US </button>
    <div class='menu-container burger-hidable container' style='display: none;'>
      <%= image_tag("header/menu.png") %>
    </div>
    <div class='nav-links burger-hidable' style='display: none;'>
      <p onclick='scroller("header")'>Home</p>
      <p onclick='scroller("services")'>Services</p>
      <p onclick='scroller("how-we-work")'>How We Work</p>
      <p onclick='scroller("team")'>Team</p>
      <p onclick='scroller("why-us")'>Why Us</p>
      <p onclick='scroller("portfolio")'>Portfolio</p>
      <p onclick='scroller("contact")'>Contact Us</p>
    </div>
  </div>
</section>

head.html.slim

section#header
  .navigation-panel
    button.burger-button id=("header-burger-button container") onclick="burgerAction()" 
      = image_tag("header/burger.png")
    button.contact-us-button.burger-hidable.container onclick="scroller(\"contact\")"  CONTACT US
    .menu-container.burger-hidable.container style=("display: none;") 
      = image_tag("header/menu.png")
    .nav-links.burger-hidable style=("display: none;") 
      p onclick="scroller(\"header\")"  Home
      p onclick="scroller(\"services\")"  Services
      p onclick="scroller(\"how-we-work\")"  How We Work
      p onclick="scroller(\"team\")"  Team
      p onclick="scroller(\"why-us\")"  Why Us
      p onclick="scroller(\"portfolio\")"  Portfolio
      p onclick="scroller(\"contact\")"  Contact Us

我认为问题出在 onclick 属性中的转义引号。

考虑在属性的双引号内使用单引号:onclick="scroller('header')".

您可以在此处阅读有关转义和引用属性的更多信息:https://www.rubydoc.info/gems/slim/frames#Output_without_HTML_escaping___