Mel*_*emi 15 haml ruby-on-rails
我怎么能在HAML中做这样的事情(在Rails应用程序中这很重要)?
<li><a href="#" title="Meet the Team"><strong>Team <em>16 members</em></strong></a></li>
Run Code Online (Sandbox Code Playgroud)
编辑:如何使用link_to和路由pages_team?
rad*_*und 37
基本方法看起来像这样......
%li
%a{ :href => "#", :title => "Meet the Team" }
%strong
Team
%em 16 members
Run Code Online (Sandbox Code Playgroud)
或者使用新的哈希语法......
%li
%a{ href: "#", title: "Meet the Team" }
%strong
Team
%em 16 members
Run Code Online (Sandbox Code Playgroud)
Uni*_*key 13
%li= link_to raw('<strong>Team <em>16 members</em></strong>'), pages_team, :title => 'Meet the Team'
Run Code Online (Sandbox Code Playgroud)
要么
%li= link_to content_tag(:strong, raw("Team #{content_tag(:em, '16 members)}")), pages_team, :title => 'Meet the Team
Run Code Online (Sandbox Code Playgroud)
我认为最好的方法是:
%li
= link_to "#" do
Meet the team
%strong
Team
%em 16 members
Run Code Online (Sandbox Code Playgroud)
一起使用haml和rails语法
| 归档时间: |
|
| 查看次数: |
40120 次 |
| 最近记录: |