mirror of
https://github.com/yawaflua/LuckyDiamond.git
synced 2025-12-10 04:09:29 +02:00
refactor code to composition api
This commit is contained in:
@@ -15,7 +15,7 @@
|
|||||||
<Carousel
|
<Carousel
|
||||||
ref="carousel"
|
ref="carousel"
|
||||||
:wrapAround="true"
|
:wrapAround="true"
|
||||||
:autoplay="autoplay"
|
:autoplay="autoPlay"
|
||||||
class="no-pointer-events"
|
class="no-pointer-events"
|
||||||
:transition="150"
|
:transition="150"
|
||||||
:itemsToShow="10"
|
:itemsToShow="10"
|
||||||
@@ -39,19 +39,29 @@
|
|||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
import {reactive, ref} from 'vue'
|
||||||
|
|
||||||
import AsideBarComponent from "@/components/AsidebarComponent.vue";
|
import AsideBarComponent from "@/components/AsidebarComponent.vue";
|
||||||
import HeaderComponent from "@/components/HeaderComponent.vue";
|
import HeaderComponent from "@/components/HeaderComponent.vue";
|
||||||
import ChatComponent from "@/components/ChatComponent.vue";
|
import ChatComponent from "@/components/ChatComponent.vue";
|
||||||
import { Carousel, Slide } from "vue3-carousel";
|
|
||||||
|
import {Carousel, Slide} from "vue3-carousel";
|
||||||
import "vue3-carousel/dist/carousel.css";
|
import "vue3-carousel/dist/carousel.css";
|
||||||
|
|
||||||
import "@/assets/css/PagesStyles/games-pages/jackpot.css";
|
import "@/assets/css/PagesStyles/games-pages/jackpot.css";
|
||||||
import "@/assets/css/global.css";
|
import "@/assets/css/global.css";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
data: () => ({
|
components: {
|
||||||
autoplay: 500,
|
HeaderComponent,
|
||||||
slides: [
|
AsideBarComponent,
|
||||||
|
ChatComponent,
|
||||||
|
Carousel,
|
||||||
|
Slide,
|
||||||
|
},
|
||||||
|
setup() {
|
||||||
|
const slides = reactive([
|
||||||
{
|
{
|
||||||
img: require("@/assets/icons-games/double-game/RectangleBlackDouble.png"),
|
img: require("@/assets/icons-games/double-game/RectangleBlackDouble.png"),
|
||||||
target: "BlackDouble",
|
target: "BlackDouble",
|
||||||
@@ -76,38 +86,29 @@ export default {
|
|||||||
img: require("@/assets/icons-games/double-game/RectangleBlackDouble.png"),
|
img: require("@/assets/icons-games/double-game/RectangleBlackDouble.png"),
|
||||||
target: "BlackDouble",
|
target: "BlackDouble",
|
||||||
},
|
},
|
||||||
],
|
])
|
||||||
}),
|
let autoPlay = ref(500)
|
||||||
name: "HelpPage",
|
|
||||||
components: {
|
|
||||||
HeaderComponent,
|
|
||||||
AsideBarComponent,
|
|
||||||
ChatComponent,
|
|
||||||
Carousel,
|
|
||||||
Slide,
|
|
||||||
},
|
|
||||||
|
|
||||||
methods: {
|
function handleStepCarousel(data) {
|
||||||
handleStepCarousel(data) {
|
|
||||||
try {
|
try {
|
||||||
let { currentSlideIndex } = data;
|
let { currentSlideIndex } = data
|
||||||
|
|
||||||
if (this.slides[currentSlideIndex+1].target == "RedDouble") {
|
if (slides[currentSlideIndex + 1].target == 'RedDouble') {
|
||||||
// this.$refs.carousel.slideTo(this.currentSlideIndex);
|
stopAutoPlay()
|
||||||
|
|
||||||
// if (this.slides[this.currentSlideIndex].nickname == this.targetNickname) {
|
|
||||||
|
|
||||||
this.stopAutoplay();
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
|
||||||
console.error("Error in handleSlideStart:", error);
|
|
||||||
}
|
}
|
||||||
},
|
catch (error) {
|
||||||
stopAutoplay() {
|
console.error(error)
|
||||||
this.autoplay = 0;
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
|
function stopAutoPlay() {
|
||||||
|
autoPlay.value = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
return { slides, autoPlay, handleStepCarousel, stopAutoPlay }
|
||||||
},
|
},
|
||||||
};
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
|||||||
Reference in New Issue
Block a user