没有值的 Html Slim 属性

标签 html slim-lang

有如下SLIM代码:

input international-phone-number="international-phone-number" type="text"

它的代码生成 HTML 代码:

<input international-phone-number="international-phone-number" type="text"></input>

但我需要得到:

<input international-phone-number type="text"></input>

如何输出没有值的 HTML 属性?

最佳答案

有多个issue reports在 GitHub 上,他们已经实现了对无值(value)属性的支持(不确定它是否仍在寺庙版本中,如果是,你将不得不使用 this )。您需要执行以下操作:

input(international-phone-number type="text")

确保你也将 :format 设置为 :html ,如下所示:

slimrb --option format=:html

关于没有值的 Html Slim 属性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27880724/

相关文章:

ruby-on-rails - 将html.slim View 转换为html.erb-Rails,Slim,ERB

ruby-on-rails - 如何在 slim (rails) 中生成新的 View 文件?

ruby-on-rails - 使用 slim 的 form_for 方法

javascript - HTML 表单 : send data to javascript function

css - FontAwesome 5 图标堆栈与标准图标不一致

html - 解析 HTML 中的 CSS 命名空间

html - 根据 Angular 字大小自动调整行的大小

javascript - 从附加按钮调用时不弹出 jquery 对话框

ruby-on-rails - Slim 中的 Ruby Each 循环

ruby-on-rails - 如何使用带有主干的超薄模板?