vue-navigator-share

A Vue component to use native sharing mechanism of the device as part of the Web Share API.
9,549 21
Install
npm install vue-navigator-share
Latest Version:1.0.3
License:MIT
Last Updated:Nov 29, 2018
Links: GitHub  ·  npm
Maintainer: gabrielbibiano

vue-navigator-share

A Vue component to use native sharing mechanism of the device as part of the Web Share API.

Support only https and mobile browser Demo

Instalation

$ npm install --save vue-navigator-share

Properties

prop type description required
on-error Function callback on error false
on-success Function callback on success false
url String url to share true
title String title to share false
text String text to share false

Usage

<navigator-share
  v-bind:on-error="function"
  v-bind:on-success="otherFunction"
  url="url_to_share"
  title="title_to_share"
  text="text_to_share"
></navigator-share>
<script>
import NavigatorShare from 'vue-navigator-share'

export default {
  name: 'app',
  data () {
    return {
    }
  },
  components: {
    NavigatorShare
  },
  methods: {
  }
}
</script>

Example

<navigator-share
  v-bind:on-error="onError"
  v-bind:on-success="onSuccess"
  v-bind:url="url"
  v-bind:title="title"
  text="Hello World"
></navigator-share>
<script>
import NavigatorShare from 'vue-navigator-share'

export default {
  name: 'app',
  data () {
    return {
    }
  },
  components: {
    NavigatorShare
  },
  computed: {
    url() {
      return window.location.href;
    },
    title() {
      return document.title;
    }
  },
  methods: {
    onError(err) {
      alert(err);
      console.log(err);
    },
    onSuccess(err) {
      console.log(err);
    }
  }
}
</script>

Related Packages

vue3-social-share

vue3的快捷分享组件

3,678 13
vue-socialmedia-share

Vue component for social sharing

12,119 68
vue-global-var

Reactive global variable can be sharable between components

9,559 22
vue-add-to-calendar

A Vue.js component providing 'Add to Calendar' functionality

13,666 130
vue-goodshare

Vue.js component for social share. A simple way to share a link on the pages of...

13,615 447

Version History

Version Released License
1.0.3 MIT
1.0.2 MIT
1.0.1 MIT
1.0.0 MIT