带有Bootstrap-vue中的传单,单击标记时会删除默认对话框弹出窗口

问题描述 投票:0回答:1

在vue / bootstrap-vue应用程序中,带有传单1.6.0,我在单击标记时创建了自定义模式对话框而且我无法删除默认对话框弹出窗口。我知道

            let nextMarker = this.leaflet.marker(
                [nextLocationPoint.lat, nextLocationPoint.lng], {icon: markerIcon})
                .addTo(locationsMap)
                .bindPopup(nextLocationPoint.title)
                .on('mouseover', this.locationMarkerOnMouseOver)
                .on('click', this.locationMarkerOnClick)  

    methods: {

        locationMarkerOnClick(e) {
            console.log('locationMarkerOnClick e::')
            console.log(e)

            // e.stopPropagation()  // THIS RAISE ERROR
            // e.preventDefault()  // THIS RAISE ERROR

            e.cancelBubble = true
            window.event.cancelBubble = true  // NOTHING OF THESE METHODS WORK
            window.event.preventDefault(e)
            window.event.stopPropagation()

            this.$bvModal.show('viewAdLocationModal')

            return false
        }, // locationMarkerOnClick(e) {

我知道在vuejs语法中,如:

<div @click.stop.prevent.self="">

OR

@click.prevent="handleClick"

但是,如果可以用于我的单张案件?

如何解决此问题?

"bootstrap-vue": "^2.3.0",
"vue": "^2.6.11",

谢谢!

javascript leaflet bootstrap-vue
1个回答
0
投票

通过此Disable popup window while using the measure tool in leaflet链接,我在:]中找到了一个决定。

let nextMarker = this.leaflet.marker(
    [nextLocationPoint.lat, nextLocationPoint.lng], {icon: markerIcon})
    .addTo(locationsMap)
    .bindPopup(nextLocationPoint.title)
    .on('mouseover', this.locationMarkerOnMouseOver)
    .on('click', this.locationMarkerOnClick)
    .on('popupopen', this.locationMarkerOnPopupOpen)  

和:

locationMarkerOnPopupOpen(e) {
    console.log('locationMarkerOnPopupOpen e::')
    console.log(e)
    e.sourceTarget.closePopup();
    return false
}, // locationMarkerOnPopupOpen(e) {

这就是我所需要的!

© www.soinside.com 2019 - 2024. All rights reserved.