我很难理解基本的Slim语法。
第一个问题,如何输入新行(换行)?
第二个请求,你能重写下面的片段吗,我想我做的不是很容易吗?
- provide(:title, @course.title)
.row
aside.span4
section
h1 = @course.title.capitalize
=> link_to t('ui.edit'), edit_course_path(@course)
'|
=> link_to t('ui.back'), courses_path
p
b #{t('activerecord.attributes.subject.title')}:
| #{@course.subject.title}
p
b #{t('activerecord.attributes.student_level.title')}:
| #{@course.student_level.title}
h4 #{t('activerecord.attributes.course.objectives')}
= @course.objectives这是它的产出:
标题a
(编辑)\x{e76f} orqaga
Predmet nomi:英语5-7岁
O‘’quvchi darajasi:初学者
哈奇达·马鲁莫
目标b
发布于 2013-09-18 16:21:49
对于新行,只需使用br如下:
h1 Line1 content
br
h1 Line2 content关于上面提到的代码,可以这样重写:
-provide(:title,@course.title)
.row
aside.span4
section
h1 = @course.title.capitalize
= link_to t('ui.edit'), edit_course_path(@course)
'|
= link_to t('ui.back'), courses_path
p
b = t('activerecord.attributes.subject.title')
|:
= @course.subject.title
p
b = t('activerecord.attributes.student_level.title')
|:
= @course.student_level.title
h4 = t('activerecord.attributes.course.objectives')
= @course.objectives发布于 2017-06-11 11:56:36
要将br标记插入到苗条中的某些标记中:
示例1. Slim模板:
h1
| Hello
br
| world它将产生html:
<h1>Hello<br>world</h1>示例2.用于显示表单的瘦模板的片段:
p
= f.label :title
br
= f.text_field :title它将产生html:
<p>
<label for="question_title">Title</label><br>
<input name="question[title]" id="question_title" type="text">
</p>https://stackoverflow.com/questions/18877236
复制相似问题