vue-social-sharing社交分享组件

这是最近看到的一个vue的社交分享组件。vue-social-sharing支持facebook,Google +,LinkedIn,Pinterest,Reddit,Twitter,VKontakte,Weibo,Whatsapp平台的分享功能。使用也十分简单。
这里是Demo

安装

通过NPM安装
npm install --save vue-social-sharing
通过Yarn安装
yarn add vue-social-sharing
通过Bower安装
bower install vue-social-sharing

插件应用

Browserify / Webpack加载组件库

var SocialSharing = require('vue-social-sharing');

Vue.use(SocialSharing);

html加载组件库

<script src="/dist/vue-social-sharing.min.js"></script>

使用组件

<social-sharing url="https://vuejs.org/" inline-template>
  <div>
      <network network="facebook">
        <i class="fa fa-facebook"></i> Facebook
      </network>
      <network network="googleplus">
        <i class="fa fa-google-plus"></i> Google +
      </network>
      <network network="linkedin">
        <i class="fa fa-linkedin"></i> LinkedIn
      </network>
      <network network="pinterest">
        <i class="fa fa-pinterest"></i> Pinterest
      </network>
      <network network="reddit">
        <i class="fa fa-reddit"></i> Reddit
      </network>
      <network network="twitter">
        <i class="fa fa-twitter"></i> Twitter
      </network>
      <network network="vk">
        <i class="fa fa-vk"></i> VKontakte
      </network>
      <network network="weibo">
        <i class="fa fa-weibo"></i> Weibo
      </network> 
      <network network="whatsapp">
        <i class="fa fa-whatsapp"></i> Whatsapp
      </network>
  </div>
</social-sharing>

插件参数

名称类型默认值说明
urlStringcurrent分享的url
titleString-分享的标题
descriptionString-分享的描述
quoteString-facebook的quote,只有facebook使用
hashtagsString-标签,用逗号分割
twitter-userString-Twitter user,只有twitter使用
mediaString-多媒体链接,只有Pinterest 使用

事件

名称数据描述
social_shares_openNetwork object, shared url当分享弹出框打开时触发
social_shares_changeNetwork object, shared url当已有分享弹出框打开,用户又触发一个分享弹出框时触发
social_shares_closeNetwork object, shared url当分享弹出框关闭或使用其它分享弹出框时触发

参考地址:轮子工厂

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
`vue-beautiful-chat`是一个基于Vue2的聊天组件,支持实时聊天、多人聊天、消息记录等功能,使用起来非常方便。下面是使用`vue-beautiful-chat`的步骤: 1. 安装`vue-beautiful-chat` 可以使用npm命令进行安装:`npm install vue-beautiful-chat` 2. 引入并使用组件Vue组件中引入`vue-beautiful-chat`组件,并在`template`中使用: ```html <template> <div> <h1>聊天室</h1> <vue-beautiful-chat :messages="messages" @message="handleMessage" /> </div> </template> <script> import VueBeautifulChat from "vue-beautiful-chat"; export default { components: { VueBeautifulChat, }, data() { return { messages: [], }; }, methods: { handleMessage(message) { // 处理接收到的消息 console.log("Received message:", message); }, }, }; </script> ``` 在上面的代码中,`vue-beautiful-chat`组件的属性`messages`用来绑定消息数组,`@message`事件用来处理接收到的消息。 3. 发送消息 可以使用`vue-beautiful-chat`组件提供的`sendMessage`方法发送消息: ```javascript this.$refs.chat.sendMessage({ type: "text", content: "Hello, world!", sender: { name: "John Doe", avatar: "https://randomuser.me/api/portraits/men/1.jpg", }, }); ``` 其中,`type`表示消息类型(可以是文本、图片、音频等),`content`表示消息内容,`sender`表示消息发送者的信息。 4. 消息记录 `vue-beautiful-chat`组件提供了`loadMessages`方法用来加载历史消息记录: ```javascript this.$refs.chat.loadMessages([ { type: "text", content: "Hello, world!", sender: { name: "John Doe", avatar: "https://randomuser.me/api/portraits/men/1.jpg", }, }, // ... ]); ``` 以上是使用`vue-beautiful-chat`的基本步骤,具体的功能和使用方法可以参考`vue-beautiful-chat`的官方文档。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值