From 45662d42f181b930af8af44558be66794112f547 Mon Sep 17 00:00:00 2001 From: EGOIST <0x142857@gmail.com> Date: Sat, 8 Jun 2019 13:16:16 +0800 Subject: [PATCH] feat: add logo option --- src/components/Header.vue | 20 +++++++++++++++++++- website/docs/options.md | 10 ++++++++++ website/docs/zh/options.md | 10 ++++++++++ 3 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/components/Header.vue b/src/components/Header.vue index 345973b0..08000166 100644 --- a/src/components/Header.vue +++ b/src/components/Header.vue @@ -5,7 +5,7 @@

- {{ $store.getters.config.title }} +

@@ -48,6 +48,24 @@ export default { return item.position === 'right' || !item.position }) ) + }, + + Logo() { + const {title, logo} = this.$store.getters.config + + if (typeof logo === 'string') { + return {template: logo} + } + + if (typeof logo === 'object') { + return logo + } + + return { + render(h) { + return h('span', null, [title]) + } + } } } } diff --git a/website/docs/options.md b/website/docs/options.md index 7cb5a4b6..395666f5 100644 --- a/website/docs/options.md +++ b/website/docs/options.md @@ -20,6 +20,16 @@ The ID of the target element to locate, e.g. `app` or `#app`. Website title. +## logo + +- Type: `string` `object` +- Default: `{{ $store.getters.config.title }}` + +Customize the logo in header. + +- `string`: Used as Vue template. +- `object`: Used as Vue component. + ## nav - Type: `Array` diff --git a/website/docs/zh/options.md b/website/docs/zh/options.md index 36329e30..3fd2f870 100644 --- a/website/docs/zh/options.md +++ b/website/docs/zh/options.md @@ -21,6 +21,16 @@ new Docute(options) 网站标题。 +## logo + +- Type: `string` `object` +- Default: `{{ $store.getters.config.title }}` + +Customize the logo in header. + +- `string`: Used as Vue template. +- `object`: Used as Vue component. + ## nav - 类型: `Array`