【问题标题】:Slim - How to close ruby tag in viewSlim - 如何在视图中关闭 ruby​​ 标签
【发布时间】:2014-03-17 19:17:06
【问题描述】:

我想关闭 f.radio-button 标记,以便在单选按钮后添加一些文本。

我尝试了以下方法,但 / 给了我一个错误,所以我认为这不是正确的方法。

= f.radio_button :budget_type, 'budget', :checked => true/ Budget Account

如何关闭我的f.radio_button 标签,使其看起来类似于以下内容:

= <%= f.radio_button :budget_type, 'budget', :checked => true %>Budget Account

【问题讨论】:

    标签: ruby-on-rails ruby-on-rails-3 slim-lang


    【解决方案1】:

    你可以在行首使用|来表示文本。

    = f.radio_button :budget_type, 'budget', :checked => true
    | Budget Account
    

    【讨论】:

    • 感谢您的帮助。你介意解释一下管道的作用吗?我已阅读文档,但对我来说没有意义:The pipe tells Slim to just copy the line. It essentially escapes any processing. Each following line that is indented greater than the pipe is copied over.
    • 我只是把它理解为纯文本并像这样使用它:) 尽管有这样的解释,但如果我没记错的话,Slim doc 实际上有一些示例可以使用它来显示纯文本。
    猜你喜欢
    • 2016-03-12
    • 2019-01-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-03
    相关资源
    最近更新 更多