使用小胡子中的变量在haml中设置属性 [英] Set attributes in haml using variable in mustache

查看:85
本文介绍了使用小胡子中的变量在haml中设置属性的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我同时使用haml和胡须作为前端.有一个代码段:

I'm using both haml and mustache for frontend. There is a code snippet:

.module-subtitle
  {{title}}

我想使用{{title}}中的内容显示具有title属性的.module-subtitle的工具提示.我尝试过

I want to show a tooltip for .module-subtitle with title attribute, using the content inside {{title}}. I tried

.module-subtitle{ :"title" => {{title}}}
  {{title}}

,但是它没有语法错误,因此无法正常工作.有提示吗?

but it didn't work as it has syntax error. Any hints?

推荐答案

您可以使用:plain,如下所示:

You could use :plain, something like this:

:plain
  <div class="module-subtitle" title="{{title}}">
    {{title}}
  </div>

这篇关于使用小胡子中的变量在haml中设置属性的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆