javascript
  • css
  • playframework-2.5
  • 2017-07-06 53 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")' 
    
    相關問題