简体   繁体   中英

How to use Haml haml_tag method with custom attributes?

I want to reproduce the haml code below by using the haml_tag method.

= %img { alt:'Hi' , src: 'hi.jpg' }

Can anyone help?

Nah.. I've just realized that. There it goes:

- haml_tag :img, { alt:'Hi' , src: 'hi.jpg' }

Attention to the details of - instead of = . haml_tag method report directly to the haml model.

Easier than I thought. :)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM