overtrue / share.js

一键分享到微博、QQ空间、QQ好友、微信、腾讯微博、豆瓣、Facebook、Twitter、Linkedin、Google+、点点等
MIT License
3.69k stars 808 forks source link

单页应用该怎么使用? #94

Open huangche007 opened 6 years ago

huangche007 commented 6 years ago

最近在用Vuejs做个社区,需要用到分享功能,试了一下你的这个插件,发现实现不了分享功能

qiqihaobenben commented 6 years ago

有npm包,vue-social-share。

paddingme commented 6 years ago

@huangche007 将 css,js 引进 index.html, view 模板页 插入 dom 结构,

<div id="socialShare"</div>

vue mounted 钩子里调用,类似如下,

  mounted() {
      window.socialShare('#socialShare', {
       // 这里配置各种参数
        sites: ['weibo', 'wechat', 'twitter','google'],
        mode: 'prepend',
        url: this.$route.fullPath,
        title:this.item.title ,
      })
}
flyingkang commented 6 years ago

应用需要去微信等开发者网站上注册appid吗?

overtrue commented 6 years ago

@flyingkang 肯定啊,这没得选。