Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我有这样的模板:
<div class="lift:ThisIsMySnippet?option1=a_value;option2=another_value"> <div class="morestuff"> {embed} </div> </div>
然后是这样的片段:
class ThisIsMySnippet { // I want option1's value! }
我如何获得这些值?
S我相信您可以通过这样的对象获取片段的参数值:
S
val x = S.attr("option1")
在这种情况下,x将是 a Box[String],因此如果您想以安全的方式获取值,您可以这样做:
x
Box[String]
val x = S.attr("option1") openOr "defaultValue"