Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript VueJS@单击传递数据_Javascript_Vue.js - Fatal编程技术网

Javascript VueJS@单击传递数据

Javascript VueJS@单击传递数据,javascript,vue.js,Javascript,Vue.js,我正在使用vue谷歌地图,并尝试在地图上绘制多边形。在这一点上,我很好,但我想在我点击的地图上得到纬度和液化天然气的位置。当我这么做的时候 <GmapPolygon v-for="cabstand in cabstands" :path="cabstand.positions" @click="getCabstandClick"/> 我可以得到一个具有lat&lng位置的对象,但我必须触发两种方法,所以我使用类似这样的方法 <GmapPolygon v-for="cabsta

我正在使用vue谷歌地图,并尝试在地图上绘制多边形。在这一点上,我很好,但我想在我点击的地图上得到纬度和液化天然气的位置。当我这么做的时候

<GmapPolygon v-for="cabstand in cabstands" :path="cabstand.positions" @click="getCabstandClick"/>
我可以得到一个具有lat&lng位置的对象,但我必须触发两种方法,所以我使用类似这样的方法

<GmapPolygon v-for="cabstand in cabstands" :path="cabstand.positions" @click="getCabstandClick ; getCabstandInfos(cabstand)"/>

我的控制台中没有日志,就好像它不再执行我的第一个方法一样。我试着用一个在我的两种方法之间,使用和&但这总是一样的

有人能帮我吗


谢谢,

单击可调用两种方法的单个方法:

<GmapPolygon v-for="cabstand in cabstands" :path="cabstand.positions" @click="callBothMethods(cabstand)"/>

methods: {
    callBothMethods(cabstand) {
        this.getCabstandClick();
        this.getCabstandInfos(cabstand);
    }
}

方法:{
调用两种方法(驾驶室支架){
这个.getCabstandClick();
这个.getCabstandInfos(cabstand);
}
}

好的,我终于找到了解决方案:我在方法中使用了$event变量

<GmapPolygon v-for="cabstand in cabstands" :path="cabstand.positions" @click="getCabstandInfos(cabstand, $event)"/>


谢谢您的帮助。

谢谢,但它正在记录“未定义”
<GmapPolygon v-for="cabstand in cabstands" :path="cabstand.positions" @click="getCabstandInfos(cabstand, $event)"/>