开发者

{name} is not replaced if they are in the attributes, how to handle?

开发者 https://www.devze.com 2023-02-12 04:32 出处:网络
The test开发者_JAVA技巧 code is: val s = \"#\" val x = <a href=\"{s}\">{s}</a> println(x)

The test开发者_JAVA技巧 code is:

val s = "#"
val x = <a href="{s}">{s}</a>
println(x)

It prints:

<a href="{s}">#</a>

Notice the {s} is still there in the attribute, how to fix it?


val s = "#"
val x = <a href={s}>{s}</a>
println(x)

Notice no quotes! Prints:

<a href="#">#</a>
0

精彩评论

暂无评论...
验证码 换一张
取 消