D
D
Dima Pautov2017-08-07 17:21:46
Vue.js
Dima Pautov, 2017-08-07 17:21:46

How to hide all points on the map when clicking on 1 of them?

Good evening! I have something like this

A photo
0db8af9a422043749f9a717ebc119633.PNG

It has points on the map, when you click on a point, a description of the point appears above it, the name of the city + link.
Here is the component code:
<div
            class="point_wrap"
            :style="{
                left: point.map_x + '%',
                top: point.map_y + '%'
            }"
    >

        <div class="point" @click="tooltipToggle"></div>

            <div class="pointTooltip" v-if="tooltipVisible">
                <div class="pointTooltipTitle">{{ point.name }}</div>
                <a
                        href=""
                        class="pointTooltipGo"
                        @click.prevent="openPanorama"
                >Начать прохождение</a>
            </div>
    </div>

export default {
data(){
        return {
            tooltipVisible: false
        };
    },

methods: {
        tooltipToggle(){

            this.tooltipVisible = !this.tooltipVisible;

        }
}
}

How to hide all points on the map when clicking on 1 of them? After all, each point is a separate component. There is 1 idea, generate an event in the tooltipToggle and listen to it in the parent and hide everything except the one that is clicked

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Evgeny Kulakov, 2017-08-07
@kulakoff Vue.js

Yes, do it. When a point is clicked, it generates an event; in the parent, the handler hides everything except this point.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question