Play 框架:如何使用“moreStyles"和“moreScripts" [英] Play framework : how to use "moreStyles" and "moreScripts"

查看:21
本文介绍了Play 框架:如何使用“moreStyles"和“moreScripts"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

main.html文件中,在Play!创建的默认项目中,有这一行:

In the file main.html, in default project created by Play!, there's this line :

#{get 'moreStyles' /}

我明白如果我需要添加更多样式,在我的视图脚本中,我必须使用

I understand that if I need to add more styles, in my view script, I have to use

#{set tag:'value' /}

其中 tag 应该是 moreStyles,但是将值设置为完整的 HTML <link> 标签似乎很糟糕.如果视图需要添加更多样式或脚本会怎样?

where tag should be moreStyles, but it seems worng to set the value to the full HTML <link> tag. And what happens if the view needs to add more styles, or scripts?

谢谢!

推荐答案

您可以通过以下方式设置更多样式:

you set more styles with:

#{set 'moreStyles'}
        #{stylesheet 'main.css' /}
#{/set}

喜欢脚本:

#{set 'moreScripts'}
    #{script 'base64.js'/}
#{/set}

这篇关于Play 框架:如何使用“moreStyles"和“moreScripts"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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