2020-03-19 13:26:06 +08:00
|
|
|
<template>
|
2020-03-19 18:26:48 +08:00
|
|
|
<n-h1 :id="id" class="naive-doc-title">
|
2020-05-31 00:57:47 +08:00
|
|
|
<span>{{ text }}</span>
|
2020-03-19 18:26:48 +08:00
|
|
|
<span class="edit-button">
|
2020-12-12 13:51:22 +08:00
|
|
|
<n-tooltip trigger="hover" placement="right" :show-arrow="true">
|
2020-11-03 15:10:29 +08:00
|
|
|
<template #activator>
|
2020-03-19 18:26:48 +08:00
|
|
|
<edit-on-github-button
|
|
|
|
text
|
|
|
|
class="edit-button"
|
2020-09-04 01:06:39 +08:00
|
|
|
:relative-url="relativeUrl"
|
2020-03-19 18:26:48 +08:00
|
|
|
/>
|
|
|
|
</template>
|
2020-10-08 04:14:14 +08:00
|
|
|
{{ t('editOnGithub') }}
|
2020-03-19 18:26:48 +08:00
|
|
|
</n-tooltip>
|
|
|
|
</span>
|
2020-03-19 13:26:06 +08:00
|
|
|
</n-h1>
|
|
|
|
</template>
|
2020-03-19 18:26:48 +08:00
|
|
|
|
2020-03-19 13:26:06 +08:00
|
|
|
<script>
|
2020-10-30 17:42:34 +08:00
|
|
|
import { i18n } from '../util-composables'
|
2020-10-08 04:14:14 +08:00
|
|
|
|
2020-03-19 13:26:06 +08:00
|
|
|
export default {
|
|
|
|
name: 'EditOnGithubHeader',
|
|
|
|
props: {
|
2020-09-04 01:06:39 +08:00
|
|
|
relativeUrl: {
|
2020-03-19 13:26:06 +08:00
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
type: String,
|
|
|
|
required: true
|
|
|
|
}
|
|
|
|
},
|
2020-10-08 04:14:14 +08:00
|
|
|
setup () {
|
|
|
|
return {
|
2020-12-12 13:51:22 +08:00
|
|
|
...i18n({
|
2020-10-08 04:14:14 +08:00
|
|
|
'zh-CN': {
|
2020-11-03 15:10:29 +08:00
|
|
|
editOnGithub: '在 Github 上编辑'
|
2020-10-08 04:14:14 +08:00
|
|
|
},
|
|
|
|
'en-US': {
|
2020-11-03 15:10:29 +08:00
|
|
|
editOnGithub: 'Edit on Github'
|
2020-10-08 04:14:14 +08:00
|
|
|
}
|
2020-12-12 13:51:22 +08:00
|
|
|
})
|
2020-10-08 04:14:14 +08:00
|
|
|
}
|
|
|
|
},
|
2020-03-19 13:26:06 +08:00
|
|
|
computed: {
|
|
|
|
id () {
|
|
|
|
return this.text.replace(/ /g, '-')
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</script>
|
2020-03-19 18:26:48 +08:00
|
|
|
|
|
|
|
<style scoped>
|
2020-05-31 00:57:47 +08:00
|
|
|
.naive-doc-title {
|
|
|
|
display: flex;
|
|
|
|
}
|
|
|
|
|
2020-03-19 18:26:48 +08:00
|
|
|
.naive-doc-title .edit-button {
|
2020-11-28 13:34:45 +08:00
|
|
|
margin-left: 4px;
|
2020-03-19 18:26:48 +08:00
|
|
|
display: inline-flex;
|
|
|
|
align-items: center;
|
|
|
|
}
|
2020-03-19 13:26:06 +08:00
|
|
|
</style>
|