Answer the question
In order to leave comments, you need to log in
How to make letter numbering?
How to make the letter numbering go through the loop? A,B,C...Z,AA,AB,AC etc.
In general, we need an analogue as in css, only through js.
counter-increment: col;
content: counter(col, upper-alpha);
Answer the question
In order to leave comments, you need to log in
methods: {
createAlphaIndex(num) {
const base = 26;
let str = '';
do {
const mod = num % base;
num = num / base | 0;
str = (mod ? String.fromCharCode('A'.charCodeAt(0) + mod - 1) : (--num, 'Z')) + str;
} while(num);
return str;
},
},
<div v-for="i in 1000">{{ createAlphaIndex(i) }}</div>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question