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.
我正在关注 Lift 网站上的教程:http: //simply.liftweb.net/index-6.3.html#prev但我自己无法弄清楚如何在不关闭会话的情况下清空购物车内容。
您可以将以下方法添加到类中,该方法将通过将 的内容替换为空Cart来清除购物车。ValueCellVector
Cart
ValueCell
Vector
def removeAllItems() = contents.atomicUpdate(v => Vector.empty)
Regis Jean-Gilles 的评论也将起作用,但使用该atomicUpdate方法将处理同步。
atomicUpdate