diff --git a/components/Share.vue b/components/Share.vue index 3add317a..ab43af7d 100644 --- a/components/Share.vue +++ b/components/Share.vue @@ -4,6 +4,10 @@ share:

+ @@ -58,6 +62,7 @@ }, data() { return { + hasShareApi: false, preset: { url: this.$base + this.$route.path, title: this.title, @@ -69,6 +74,11 @@ } }; }, + mounted() { + if (process.client) { + this.hasShareApi = navigator.share !== undefined; + } + }, methods: { link(network) { return NETWORKS[network](this.preset); @@ -78,7 +88,14 @@ }, icon(network) { return ICONS[network] || network; - } - } + }, + shareApi() { + navigator.share({ + url: this.preset.url, + title: this.preset.title, + text: this.preset.extra.text, + }); + }, + }, }