mirror of
https://github.com/em-squared/5e-drs.git
synced 2025-10-30 13:14:20 +00:00
share link
This commit is contained in:
commit
66757c7cf0
4 changed files with 20 additions and 15 deletions
|
|
@ -54,9 +54,9 @@
|
|||
</v-card-title>
|
||||
|
||||
<v-card-text>
|
||||
<v-text-field id="copy-uri" outlined readonly label="Copiez le lien pour partager" :hint="hintCopied" :value="$site.themeConfig.domain + '/homebrew/?brew=' + encodeURI($store.state.shareURI)" append-outer-icon="mdi-content-copy" @click:append-outer="copyURI('copy-uri')"></v-text-field>
|
||||
<v-text-field id="copy-uri" outlined readonly label="Copiez le lien pour partager" :hint="hintCopied" :value="shortenURL($site.themeConfig.domain + '/homebrew/?h=' + $store.state.shareURI)" append-outer-icon="mdi-content-copy" @click:append-outer="copyURI('copy-uri')"></v-text-field>
|
||||
<div class="text-center">
|
||||
<v-btn color="accent" depressed link :to="{ path: '/homebrew/', query: { brew: encodeURI($store.state.shareURI) }}" @click="$store.commit('setIsOpenShareHomebrewDialog', !$store.state.isOpenShareHomebrewDialog)">Voir la page</v-btn>
|
||||
<v-btn color="accent" depressed link :to="{ path: '/homebrew/', query: { h: $store.state.shareURI }}" @click="$store.commit('setIsOpenShareHomebrewDialog', !$store.state.isOpenShareHomebrewDialog)">Voir la page</v-btn>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
|
|
@ -71,9 +71,7 @@ import Navbar from '@theme/components/Navbar.vue'
|
|||
import NavDrawer from '@theme/components/NavDrawer.vue'
|
||||
import RightDrawer from '@theme/components/RightDrawer.vue'
|
||||
import Vue from 'vue'
|
||||
import RuleTooltip from '@theme/global-components/RT'
|
||||
import Cookies from 'js-cookie'
|
||||
import { shortlink } from 'shortlink'
|
||||
|
||||
export default {
|
||||
name: 'GlobalLayout',
|
||||
|
|
@ -177,11 +175,18 @@ export default {
|
|||
this.$store.commit('setRightDrawer', !this.$store.state.rightDrawer)
|
||||
},
|
||||
|
||||
encodeURI (h) {
|
||||
return shortlink.encode(h)
|
||||
shortenURL (url) {
|
||||
// var isgd = require('isgd')
|
||||
|
||||
isgd.shorten('http://google.com', function(res) {
|
||||
console.log(res)
|
||||
return res
|
||||
})
|
||||
|
||||
return url
|
||||
},
|
||||
|
||||
copyURI(id) {
|
||||
copyURI (id) {
|
||||
let toCopy = document.getElementById(id)
|
||||
toCopy.select()
|
||||
document.execCommand( 'copy' )
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ export default {
|
|||
},
|
||||
|
||||
mounted () {
|
||||
let brew64 = this.$route.query.brew
|
||||
let brew64 = this.$route.query.h
|
||||
if (brew64) {
|
||||
this.brew = decode(brew64)
|
||||
}
|
||||
|
|
@ -117,7 +117,7 @@ export default {
|
|||
|
||||
methods: {
|
||||
share () {
|
||||
this.$store.commit('setShareURI', this.$route.query.brew)
|
||||
this.$store.commit('setShareURI', this.$route.query.h)
|
||||
this.$store.commit('setIsOpenShareHomebrewDialog', true)
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue