new Vue({
el: "#app",
data: {
number: 11,
output: "",
},
computed: {},
methods: {
getRandomIntInclusive(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min + 1)) + min;
},
generate() {
const characters = '0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_';
let result = '';
for (let i = 0; i < this.number; i++) {
result += characters[this.getRandomIntInclusive(0, characters.length - 1)];
}
this.output = result;
},
},
mounted() {
this.generate();
}
})