Added getKittens method (placeholder images)
This commit is contained in:
parent
3094f5437a
commit
11f0e038d3
1 changed files with 19 additions and 0 deletions
|
@ -11,6 +11,25 @@ export default {
|
||||||
return muscles;
|
return muscles;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
getKittens(count) {
|
||||||
|
let kittens = [];
|
||||||
|
|
||||||
|
for (let i = 0; i < count; i++) {
|
||||||
|
let width = this.getRandomInt(300, 600);
|
||||||
|
let height = this.getRandomInt(300, 600);
|
||||||
|
kittens.push(`https://placekitten.com/${width}/${height}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
return kittens;
|
||||||
|
},
|
||||||
|
|
||||||
|
getRandomInt(min, max) {
|
||||||
|
min = Math.ceil(min);
|
||||||
|
max = Math.floor(max);
|
||||||
|
max++; // make it inclusive
|
||||||
|
return Math.floor(Math.random() * (max - min)) + min;
|
||||||
|
},
|
||||||
|
|
||||||
getClientLocale() {
|
getClientLocale() {
|
||||||
if (navigator.language) {
|
if (navigator.language) {
|
||||||
return navigator.languages[0];
|
return navigator.languages[0];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue