我是通过if else标签重复输出td完成的,有没有更简洁的写法?
- if match_array[0] == false
td class="success" = obj.shoulder
- else
td = obj.shoulder
- if match_array[1] == false
td class="success" = obj.chest
- else
td = obj.chest
- if match_array[2] == false
td class="success" = obj.arm_relaxed
- else
td = obj.arm_relaxed
Slim模板里面通过if判断设定Class标签?
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
1条回答 默认 最新
- mem_fox 2016-02-29 23:43关注
改成这样了,求更简洁写法
d = obj.member_name
td class="#{"success" if match_array[0] == false}" = obj.shoulder
td class="#{"success" if match_array[1] == false}" = obj.chest
td class="#{"success" if match_array[2] == false}" = obj.arm_relaxed
td class="#{"success" if match_array[3] == false}" = obj.waist
td class="#{"success" if match_array[4] == false}" = obj.hip
td class="#{"success" if match_array[5] == false}" = obj.thigh
td = edit_with_delete(obj)解决 无用评论 打赏 举报