Dynamic edit links
This commit is contained in:
parent
19afe8a664
commit
9580dd0b25
2 changed files with 19 additions and 8 deletions
|
@ -7,13 +7,15 @@
|
|||
|
||||
<script>
|
||||
export default {
|
||||
props: ['path'],
|
||||
data () {
|
||||
return {
|
||||
githubUrl: ''
|
||||
}
|
||||
},
|
||||
name: 'EditLink',
|
||||
created () {
|
||||
methods: {
|
||||
updateUrl () {
|
||||
this.githubUrl = 'https://github.com/'+ this.$site.themeConfig.repo + '/edit/' + this.$site.themeConfig.docsBranch;
|
||||
|
||||
if(this.$page.path == '/') {
|
||||
|
@ -22,5 +24,14 @@ export default {
|
|||
this.githubUrl = this.githubUrl + this.$page.path.replace('.html', '.md');
|
||||
}
|
||||
}
|
||||
},
|
||||
created () {
|
||||
this.updateUrl();
|
||||
},
|
||||
watch: {
|
||||
path () {
|
||||
this.updateUrl();
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -35,7 +35,7 @@
|
|||
|
||||
<Content custom></Content>
|
||||
|
||||
<edit-link></edit-link>
|
||||
<edit-link :path="this.$page.path"></edit-link>
|
||||
|
||||
</v-flex>
|
||||
|
||||
|
@ -57,7 +57,7 @@
|
|||
|
||||
<Content custom></Content>
|
||||
|
||||
<edit-link></edit-link>
|
||||
<edit-link :path="this.$page.path"></edit-link>
|
||||
|
||||
</v-flex>
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue