使用 Enjoy Template Engine 模板引擎,上手简单。

以下是一些常用方法,如需更多使用方法,请查看 Enjoy Template Engine 文档
// 调用了String对象上的substring(0, 3)方法输出值为 "ABC"
#("ABCDE".substring(0, 3))
// girl对象拥有getAge()方法时可调用
#(girl.getAge())
// list对象的size()方法
#(list.size())
// Map类型时可调用其 get(...) 方法
#(map.get(key))
#(value)
#(object.field)
#(object.field ??)
#(a > b ? x : y)
#if(c1)
...
#else if(c2)
...
#else if (c3)
...
#else
...
#end
// 对 List、数组、Set 这类结构进行迭代
#for(x : list)
#(x.field)
#end
// 对 Map 进行迭代
#for(x : map)
#(x.key)
#(x.value)
#end
#switch (month)
#case (1, 3, 5, 7, 8, 10, 12)
#(month) 月有 31 天
#case (2)
#(month) 月平年有28天,闰年有29天
#default
月份错误: #(month ?? "null")
#end
#set(x = 123)
#set(a = 1, b = 2, c = a + b)
#set(array[0] = 123)
#set(map["key"] = 456)
#(x) #(c) #(array[0]) #(map.key) #(map["key"])