【问题标题】:How to add a link on an image using play framework and scala [closed]如何使用播放框架和scala在图像上添加链接[关闭]
【发布时间】:2023-03-11 02:43:01
【问题描述】:

使用play framework和scala如何使用静态图片作为链接(使用js或者html代码)?

【问题讨论】:

    标签: html scala playframework


    【解决方案1】:

    如果您将图像存储在 /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)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-06-09
      • 2021-08-05
      • 1970-01-01
      • 2020-06-22
      • 1970-01-01
      • 1970-01-01
      • 2014-04-18
      • 1970-01-01
      相关资源
      最近更新 更多