javascript - thymeleaf template How to generate labels in a loop with only length?
習慣沉默
習慣沉默 2017-05-27 17:40:29
0
1
738

The parameter of module is a number. How to use this number to generate a fixed number of labels in a loop?

習慣沉默
習慣沉默

reply all(1)
洪涛

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.sequencethymeleaf的内置函数了:#numbers.sequence
这个方法就是根据传入的参数生成一个数列,类似于javaforThis method generates a sequence based on the parameters passed in, similar to 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代码传入一个lengthParameters

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

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template