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.
当我在 xml 文字中插入任意表达式时,似乎.toString()插入了
.toString()
object Foo { override def toString: String = "foo" } println(<div>{Foo}</div>) // prints "<div>foo</div>"
我可以通过覆盖 toString 以外的方式自定义该过程吗?添加方法 toXml 什么的?注意,我想避免明确<div>{Foo.toXml}</div>的 .
<div>{Foo.toXml}</div>