Skip to content

Commit

Permalink
feat: add logo option
Browse files Browse the repository at this point in the history
  • Loading branch information
egoist committed Jun 8, 2019
1 parent df36126 commit 45662d4
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/components/Header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<div class="header-left">
<h1 class="site-title">
<SidebarToggle />
<router-link to="/">{{ $store.getters.config.title }}</router-link>
<router-link to="/"> <component :is="Logo" /> </router-link>
</h1>
<HeaderNav v-if="leftNav" :nav="leftNav" />
</div>
Expand Down Expand Up @@ -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])
}
}
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions website/docs/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ The ID of the target element to locate, e.g. `app` or `#app`.

Website title.

## logo

- Type: `string` `object`
- Default: `<span>{{ $store.getters.config.title }}</span>`

Customize the logo in header.

- `string`: Used as Vue template.
- `object`: Used as Vue component.

## nav

- Type: `Array<NavItem>`
Expand Down
10 changes: 10 additions & 0 deletions website/docs/zh/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,16 @@ new Docute(options)

网站标题。

## logo

- Type: `string` `object`
- Default: `<span>{{ $store.getters.config.title }}</span>`

Customize the logo in header.

- `string`: Used as Vue template.
- `object`: Used as Vue component.

## nav

- 类型: `Array<NavItem>`
Expand Down

0 comments on commit 45662d4

Please sign in to comment.