【发布时间】:2023-03-11 02:43:01
【问题描述】:
使用play framework和scala如何使用静态图片作为链接(使用js或者html代码)?
【问题讨论】:
标签: html scala playframework
使用play framework和scala如何使用静态图片作为链接(使用js或者html代码)?
【问题讨论】:
标签: html scala playframework
如果您将图像存储在 /public/images 文件夹中,您可以在视图文件中使用它:
<a href="http://www.google.com"><img src="@routes.Assets.at("images/image.jpg")"></a>
当您将公用文件夹映射到路由文件中的 /assets/*file 时,这将生成源 img 的 /assets/images/image.jpg URL:
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
【讨论】: