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