1

我使用的是與我的應用程序中的多個表單,您可以在其中輸入輸入的twitter Bootstrap 3.3.4。我可以忽略代碼中的「twitter bootstrap is deprecated」警告嗎?

樣品:

@import models.Question 
@import models.Answer 
@import helper._ 
@import helper.twitterBootstrap._ 

@(questionForm: Form[Question], questionList: List[Question]) 

@main("Ask Question"){ 

    @helper.form(action = routes.Application.sendQuestion()){ 
     <fieldset> 
      @helper.inputText(questionForm("questionID")) 
      @helper.inputText(questionForm("questionText")) 
      @helper.inputText(questionForm("voteScore")) 
      @helper.inputText(questionForm("userID")) 
      @helper.inputText(questionForm("page")) 
     </fieldset> 
     <input type="submit" class="btn btn-default"> 
    } 
} 

現在,如果我編譯,有幾個警告終端:

[warn]     @helper.inputText(questionForm("userID")) 
[warn]         ^
[warn] (...)\frageAntwort.scala.html:22: 
value twitterBootstrapField in package twitterBootstrap is deprecated: 
The twitter bootstrap field constructor will be removed from Play in 2.4 
since the way Bootstrap must be used changes too frequently and too 
drastically between versions for this to make sense to be in the core of Play 

我搜索了警告和只發現這old SO post about itissue on github

SO帖子提到寫他自己的模板助手,但作爲我自己的工作,我看到沒有必要寫一個。那麼我是否仍然可以使用我的產品並忽略這些警告,或者稍後在我的生產系統或其他任何地方發現問題?另外,如果警告沒有後果,是否有辦法隱藏它們?

回答

4

Play 2.3 migration guide有一個部分旨在解釋這個問題。它說:

的內置Twitter的引導場構造已被棄用, 並會在遊戲的未來版本中刪除。

這有幾個原因,一個是,我們發現, 引導也發生了變化急劇版本之間過於頻繁, 使得由播放快速提供任何內置的支持變得陳舊 並與當前不兼容Bootstrap版本。

另一個原因是當前Bootstrap對CSS 類的要求無法單獨使用Play的字段構造函數實現,還需要一個 自定義輸入模板。

我們前進的觀點是,如果這是一個特點,就是有價值的 社會,第三方模塊可以創建它提供了一個 組獨立的引導形式輔助模板,具體到給定 引導版本,允許比目前可提供的更好的用戶體驗 。

即使現在有效,將來也會出現問題。如果我是你,我會爲編寫定製解決方案而奔波。只有這樣,你才能確保在你的項目中進行了框架升級之後,一切仍然可以正常工作。

+0

我必須手動更新遊戲框架,是否正確?將不會自動更新到新版本? – hamena314

+0

是的。我的意思是手動升級。但在維護您的產品時可能會出現這種情況。 –

+0

好吧,然後將考慮編寫自己的模板助手來確保。謝謝! – hamena314

相關問題