2018-04-20 16:17:16 +03:00
|
|
|
<template>
|
2018-06-18 17:09:11 -05: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 16:17:16 +03:00
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2018-06-20 17:08:47 -05:00
|
|
|
export default {
|
|
|
|
props: ["path"],
|
2018-04-20 16:17:16 +03:00
|
|
|
|
2018-06-20 17:08:47 -05:00
|
|
|
data () {
|
|
|
|
return {
|
|
|
|
githubUrl: ""
|
2018-04-20 16:35:27 +03:00
|
|
|
}
|
2018-06-20 17:08:47 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
methods: {
|
|
|
|
updateUrl () {
|
2018-06-20 17:21:36 -05:00
|
|
|
this.githubUrl = `https://github.com/${this.$site.themeConfig.repo}/edit`;
|
2018-06-20 17:08:47 -05:00
|
|
|
|
2018-06-20 17:21:36 -05: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-20 17:08:47 -05:00
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
created () {
|
2018-04-20 16:35:27 +03:00
|
|
|
this.updateUrl();
|
2018-06-20 17:08:47 -05:00
|
|
|
},
|
|
|
|
|
|
|
|
watch: {
|
|
|
|
path () {
|
|
|
|
this.updateUrl();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
|
|
|
|
name: "EditLink"
|
2018-04-20 16:17:16 +03:00
|
|
|
}
|
2018-05-08 13:54:56 -05:00
|
|
|
</script>
|