This article mainly introduces the example of Vue using Facebook and Twitter to share. Now I share it with you and give it as a reference.
Record a vue usage share
Sharing reference document for fixed content
facebook sharing document
twitter sharing document
vue uses
facebook and uses sharing
to find index.html and add the code
Use in vue
The first way is html
The second way is js
facebook() { // 初始化 FB.init({ appId: 你的appid, autoLogAppEvents: true, xfbml: true, version: "v2.12" }); FB.ui( { method: "share", mobile_iframe: true, href: "http://dev.XXXX.io/?test=12345" }, function(response) {} ); },
twitter Use sharing
Find index.html and add the code
Use on the vue page
Add
javascript code in xxx.vue
twitter() { console.log(twttr) twttr.widgets.createShareButton( "http://dev.XXXX.io/?test=12345", document.getElementById("container"), { text: "分享测试", size: "large", hashtags: "example,demo", via: "twitterdev", related: "twitterapi,twitter" } ); }
The above is what I compiled for everyone. I hope it will be helpful to everyone in the future. .
Related articles:
Vue implements active click switching method
Detailed explanation of Vue.js project API and Router configuration split Practice
NodeJS method to implement irreversible encryption and password cipher text storage
The above is the detailed content of Vue uses facebook twitter to share examples. For more information, please follow other related articles on the PHP Chinese website!