vue-socials
Version:
Social media share buttons and counts for Vue.js
43 lines (39 loc) • 1.26 kB
JavaScript
import { defineComponent } from 'vue';
import BaseSocials from '../../mixins/BaseSocial/BaseSocial.js';
import getSerialisedParams from '../../utils/getSerialisedParams.js';
import getSeparatedList from '../../utils/getSeparatedList.js';
/**
* Hey!
*
* STwitter component used for Twitter social network
* @link https://twitter.com/
*/
/**
* Share parameters for link
* @link https://developer.twitter.com/en/docs/twitter-for-websites/tweet-button/overview
*/
var STwitter = /* #__PURE__ */defineComponent({
name: 'STwitter',
mixins: [BaseSocials('Twitter', undefined, undefined, undefined, false)],
computed: {
networkURL: function networkURL() {
var BASE_URL = 'https://twitter.com/intent/tweet';
var shareOptions = this.shareOptions;
var text = shareOptions.text,
url = shareOptions.url,
hashtags = shareOptions.hashtags,
via = shareOptions.via;
var serialisedParams = getSerialisedParams({
text: text,
url: url,
hashtags: getSeparatedList(hashtags),
via: via
});
return "".concat(BASE_URL).concat(serialisedParams);
}
},
render: function render() {
return this.generateComponent(this.networkURL);
}
});
export default STwitter;