From 20e0baefa7777f865f5e00b14983c30882c15064 Mon Sep 17 00:00:00 2001 From: Kostya Date: Sun, 11 Feb 2024 23:40:07 +0300 Subject: [PATCH] fixed bug with crystals-slider --- .../src/pages/games-pages/SapergamePage.vue | 70 +++++++++---------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/luckydiamond/src/pages/games-pages/SapergamePage.vue b/luckydiamond/src/pages/games-pages/SapergamePage.vue index a1d5f88..643ccb1 100644 --- a/luckydiamond/src/pages/games-pages/SapergamePage.vue +++ b/luckydiamond/src/pages/games-pages/SapergamePage.vue @@ -284,47 +284,41 @@ export default { } }, async amountCrystals(CrystalsCount) { - setTimeout(async () => { - this.PercentageGameSteps = [] - if (![1, 5, 10, 24].includes(CrystalsCount)) { - this.clickedBtnCrystal = null - } - else { - let index - switch (CrystalsCount) { - case 1: - index = 0 - break - case 5: - index = 1 - break - case 10: - index = 2 - break - case 24: - index = 3 - break - } - this.clickedBtnCrystals(index, CrystalsCount) - } + this.PercentageGameSteps = []; - if (CrystalsCount >= 1 && CrystalsCount <= 24) { - try { - await GetPercentageSteps(this.amountCrystals) - .then((response) => { - response.forEach((item) => { - if (item !== 'Infinity' && item !== '-Infinity') { - this.PercentageGameSteps.push(Number(item)) - } - }) - }) - } - catch (e) { - console.error('Error in Percantage', e) - } + if (CrystalsCount >= 1 && CrystalsCount <= 24) { + try { + const response = await GetPercentageSteps(CrystalsCount); + response.forEach((item) => { + if (item !== 'Infinity' && item !== '-Infinity') { + this.PercentageGameSteps.push(Number(item)); + } + }); + } catch (e) { + console.error('Error in Percentage', e); } - }, 200) + } + + let index; + switch (CrystalsCount) { + case 1: + index = 0; + break; + case 5: + index = 1; + break; + case 10: + index = 2; + break; + case 24: + index = 3; + break; + default: + return + } + this.clickedBtnCrystals(index, CrystalsCount); }, + flippedCards: { async handler(value) { if (value.length < 1 || this.ValidationPlay.endGame === true) return