【问题标题】:Converting data attribute in Rails from HTML to HAML将 Rails 中的数据属性从 HTML 转换为 HAML
【发布时间】:2018-09-15 14:16:09
【问题描述】:

我必须使用类 search-wrapper 向 div 添加一个数据属性,在 HTML 中它看起来像这样:

但是,我需要这样做的页面是在 HAML 中。我在弄清楚这个标签的性质在 HAML 中转换为什么来转换它时遇到了一些麻烦。到目前为止,我能得到的最接近的是:

  .search_wrapper {:data-slideout-ignore => true}

这看起来很接近,但没有通过。有人可以解决这个问题吗?

【问题讨论】:

    标签: ruby-on-rails haml nested-attributes custom-data-attribute


    【解决方案1】:

    这得到了懒散的回答:.search-wrapper{ data: { slideout: { ignore: true } } }

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-09
      相关资源
      最近更新 更多