A
A
Artemio952021-06-09 12:00:07
Vue.js
Artemio95, 2021-06-09 12:00:07

How to cancel parent event on click on child element with own event?

There are slides

<div
                        class="slider__slide js-slide pad-6"
                        v-for="slide in sliderList"
                        :key="slide.id"
                        :style="'background-image: url(' + slide.img + ')'"
                        @click="openSlide(slide.id + 1)"
                    >
                        <div
                            class="slide-content"
                        >
                            <h1>{{ slide.title }}</h1>
                            <p class="mar-bot-6">
                                {{ slide.text }}
                            </p>
                            <span class="badge-course pad-3 d-inline-block"
                            >
                                {{ slide.badge }}
                            </span>
                            <div class="mar-top-8">
                                <button class="btn btn-primary btn-course" @click="joinCourse">
                                    Записаться на курс
                                </button>
                            </div>
                        </div>
                    </div>

By clicking on each slide, I switch to the next slide. Each slide has a button with its own event. How to undo slide switching i.e. top event on button click?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Stasyuk, 2021-06-09
@HikariNoSekai

https://ru.vuejs.org/v2/guide/events.html

N
nvdfxx, 2021-06-10
@nvdfxx

@click.stop="joinCourse"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question