lbry.tech/content/.vuepress/components/EditLink.vue

35 lines
728 B
Vue
Raw Normal View History

2018-04-20 15:17:16 +02:00
<template>
2018-05-08 22:55:33 +02:00
<a v-bind:href="githubUrl" target="_blank" title="Edit this page on GitHub">Edit this page on GitHub</a>
2018-04-20 15:17:16 +02:00
</template>
<script>
export default {
2018-04-20 15:35:27 +02:00
props: ['path'],
2018-04-20 15:17:16 +02:00
data () {
return {
githubUrl: ''
}
},
name: 'EditLink',
2018-04-20 15:35:27 +02:00
methods: {
updateUrl () {
this.githubUrl = 'https://github.com/'+ this.$site.themeConfig.repo + '/edit/' + this.$site.themeConfig.docsBranch;
2018-04-20 15:17:16 +02:00
2018-04-20 15:35:27 +02:00
if(this.$page.path == '/') {
this.githubUrl = this.githubUrl + '/README.md';
} else {
this.githubUrl = this.githubUrl + this.$page.path.replace('.html', '.md');
}
}
},
created () {
this.updateUrl();
},
watch: {
path () {
this.updateUrl();
2018-04-20 15:17:16 +02:00
}
}
}
</script>