2018-04-20 15:17:16 +02:00
|
|
|
<template>
|
2018-06-19 00:09:11 +02:00
|
|
|
<a v-bind:href="githubUrl" target="_blank" rel="noopener noreferrer" title="Edit this page on GitHub">Edit this page on GitHub</a>
|
2018-04-20 15:17:16 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-06-21 00:08:47 +02:00
|
|
|
export default {
|
|
|
|
props: ["path"],
|
2018-04-20 15:17:16 +02:00
|
|
|
|
2018-06-21 00:08:47 +02:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
githubUrl: ""
|
2018-04-20 15:35:27 +02:00
|
|
|
}
|
2018-06-21 00:08:47 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
updateUrl () {
|
2018-06-21 00:21:36 +02:00
|
|
|
this.githubUrl = `https://github.com/${this.$site.themeConfig.repo}/edit`;
|
2018-06-21 00:08:47 +02:00
|
|
|
|
2018-06-21 00:21:36 +02:00
|
|
|
if (this.$page.path === "/") this.githubUrl = `${this.githubUrl}/master/README.md`;
|
|
|
|
else this.githubUrl = `${this.githubUrl}/${this.$site.themeConfig.docsBranch}/${this.$page.path.replace(".html", ".md")}`;
|
2018-06-21 00:08:47 +02:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
created () {
|
2018-04-20 15:35:27 +02:00
|
|
|
this.updateUrl();
|
2018-06-21 00:08:47 +02:00
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
path () {
|
|
|
|
this.updateUrl();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
name: "EditLink"
|
2018-04-20 15:17:16 +02:00
|
|
|
}
|
2018-05-08 20:54:56 +02:00
|
|
|
</script>
|