我在 vue 中的链接上有一个点击事件,该链接启动了一个模式,该模式有一个链接将用户引导到另一个网站。一切都按预期工作,直到我刚刚添加了谷歌分析点击事件。现在模式打开,但到另一个站点的链接只是返回到主页 /root。有没有办法在不中断的情况下调用链接上的两个点击事件?
启动模式并链接出的链接:
<a
href="https://www.linkout.com"
rel="noopener"
@click.prevent="
openInterstitial;
$ga.event('link', 'click', 'ISI_link');
"
target="_blank"
>www.linkout.com</a
>
mixin method:
Vue.mixin({
methods: {
openInterstitial(event) {
if (event) {
event.preventDefault();
this.$store.commit('modals/setInterstitialHref', event.target.href);
}
this.$store.commit('modals/setShowInterstitial', true);
}
}
});
店铺
export const state = () => ({
interstitial: {
show: false,
href: ''
}
});
export const mutations = {
setShowInterstitial(state, boolean) {
state.interstitial.show = boolean;
},
setInterstitialHref(state, string) {
state.interstitial.href = string;
}
};
炎炎设计
相关分类