Last active
March 23, 2020 03:14
-
-
Save 00xkhaled/5d77c3c8ac5c1a8c8365a285f3d6461c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// method | |
onShareLinkClick (event) { | |
if (window.device && window.device.platform && window.device.platform.toLowerCase() !== 'browser') { | |
event.preventDefault(); | |
let href = event.target.getAttribute('href'); | |
if (!href) { | |
href = event.target.parentElement.getAttribute('href'); | |
} | |
if (href) { | |
window.location.href = href; | |
} | |
} | |
}, | |
onWhatsAppShareClick (event) { | |
if (window.device && window.device.platform && window.device.platform.toLowerCase() !== 'browser') { | |
event.preventDefault(); | |
if (window && window.plugins && window.plugins.socialsharing && window.plugins.socialsharing.shareWithOptions) { | |
let message = 'I published a trip to share on lessgo'; | |
window.plugins.socialsharing.shareViaWhatsApp(message, null /* img */, decodeURIComponent(this.currentUrl), function () { | |
console.log('share ok'); | |
}, function (errormsg) { | |
console.log('share not ok:', errormsg); | |
}); | |
} | |
} | |
} | |
// interface | |
<div class="trip_share row" v-if="!isPasssengersView"> | |
<a :href="'https://www.facebook.com/sharer/sharer.php?u=' + currentUrl" target="_blank" aria-label="share on Facebook" class="lnk lnk-social-network lnk-facebook" @click="onShareLinkClick"> | |
<i class="fa fa-facebook" aria-hidden="true"></i> | |
</a> | |
<a :href="'https://twitter.com/intent/tweet/?text=texthere&via=lessgo&url=' + currentUrl" target="_blank" aria-label="Compartir en Twitter" class="lnk lnk-social-network lnk-twitter" @click="onShareLinkClick"> | |
<i class="fa fa-twitter" aria-hidden="true"></i> | |
</a> | |
<a :href="'whatsapp://send?text=here' + currentUrl" target="_blank" aria-label="Compartir en Whats App" class="lnk lnk-social-network lnk-whatsapp" v-if="isMobile" @click="onWhatsAppShareClick"> | |
<i class="fa fa-whatsapp" aria-hidden="true"></i> | |
</a> | |
</div> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment