The parameter of module is a number. How to use this number to generate a fixed number of labels in a loop?
PHP中文网2017-05-27 17:42:29
I understand your question is like this
Input: a number
Output: loop to generate a fixed label based on the size of the number, the number of labels is determined by the size of the number
If this is the case, you may need to use the built-in function of thymeleaf
: #numbers.sequence
thymeleaf
的内置函数了:#numbers.sequence
这个方法就是根据传入的参数生成一个数列,类似于java
的for
This method generates a sequence based on the parameters passed in, similar to < Code>java's for
loop is the same, supporting two parameters and three parameters
Parameter 1: starting value (inclusive)
Parameter 2: end value (inclusive)
Parameter three: step size
Give me an example~java
代码传入一个length
Parameters
The page is looping like this
Final effect:
Of course, if you want to generate fixed labels, you don’t need to worry about the loop bodyi
Similar to this