javascript
  • css
  • playframework-2.5
  • 2017-07-06 55 views 0 likes 
    0

    在视图文件中添加反向路由导致错误。以下是摘录:基于播放框架添加用于应用程序的css和js文件

    @main(title = "index") { 
    <head> 
        <link rel="stylesheet" type="text/css" href='@routes.Assets.at("/Content/Site.css")' /> 
        <script type="text/javascript" src='@routes.Assets.at("Scripts/bootstrap.js")'></script> 
    
    </head> 
    <body> 
    </body> 
    } 
    

    我已经加入了CSS和JS文件公用文件夹中

    [error] C:\myproject\app\views\index.scala.html:5: value at is not a member of controllers.ReverseAssets 
        [error]  <link rel="stylesheet" type="text/css" href='@routes.Assets.at("/Content/Site.css")' /> 
        [error]                 ^
        [error] C:\myproject\app\views\index1.scala.html:6: value at is not a member of controllers.ReverseAssets 
        [error]  <script type="text/javascript" src='@routes.Assets.at("Scripts/bootstrap.js")'></script> 
    

    任何帮助表示赞赏。

    回答

    0

    我必须使用以下语法为摆脱错误的

    <link rel="stylesheet" type="text/css" href='@routes.Assets.versioned("stylesheets/Content/bootstrap.css")' 
    
    相关问题