|
| 1 | +<a name="1.0.0-alpha.38"></a> |
| 2 | +# [1.0.0-alpha.38](https://github.com/vuejs/vuepress/compare/v1.0.0-alpha.37...v1.0.0-alpha.38) (2019-02-16) |
| 3 | + |
| 4 | + |
| 5 | +### Bug Fixes |
| 6 | + |
| 7 | +* **$plugin-pwa:** set current registration scope for service worker (close: [#1271](https://github.com/vuejs/vuepress/issues/1271)) ([#1302](https://github.com/vuejs/vuepress/issues/1302)) ([4b2b0f4](https://github.com/vuejs/vuepress/commit/4b2b0f4)) |
| 8 | +* **$theme-default:** sidebar group item cannot contain empty children (close: [#1278](https://github.com/vuejs/vuepress/issues/1278)) ([5f1eb0e](https://github.com/vuejs/vuepress/commit/5f1eb0e)) |
| 9 | + |
| 10 | + |
| 11 | +### Features |
| 12 | + |
| 13 | +* **$core:** support global layout (close: [#1226](https://github.com/vuejs/vuepress/issues/1226)) ([c91f55a](https://github.com/vuejs/vuepress/commit/c91f55a)) |
| 14 | + |
| 15 | + From now on, users have the ability to use a custom global layout component via [siteConfig](https://vuepress.vuejs.org/miscellaneous/glossary.html#siteconfig) or [themeEntryFile](https://vuepress.vuejs.org/miscellaneous/glossary.html#themeentryfile): |
| 16 | + |
| 17 | + ```js |
| 18 | + module.exports = { |
| 19 | + globalLayout: '/path/to/your/global/vue/sfc' |
| 20 | + } |
| 21 | + ``` |
| 22 | + |
| 23 | + Here is the [content of default global layout component](https://github.com/vuejs/vuepress/blob/master/packages/%40vuepress/core/lib/app/components/GlobalLayout.vue), an example of setting global header and footer: |
| 24 | + |
| 25 | + ```vue |
| 26 | + <template> |
| 27 | + <div id="global-layout"> |
| 28 | + <header><h1>Header</h1></header> |
| 29 | + <component :is="layout"/> |
| 30 | + <footer><h1>Footer</h1></footer> |
| 31 | + </div> |
| 32 | + </template> |
| 33 | + |
| 34 | + <script> |
| 35 | + export default { |
| 36 | + computed: { |
| 37 | + layout () { |
| 38 | + if (this.$page.path) { |
| 39 | + if (this.$vuepress.isLayoutExists(this.$page.frontmatter.layout)) { |
| 40 | + return this.$page.frontmatter.layout |
| 41 | + } |
| 42 | + return 'Layout' |
| 43 | + } |
| 44 | + return 'NotFound' |
| 45 | + } |
| 46 | + } |
| 47 | + } |
| 48 | + </script> |
| 49 | + ``` |
| 50 | + |
| 51 | + Also, you can follow the convention, directly create a component `.vuepress/components/GlobalLayout.vue` or `themePath/layouts/GlobalLayout.vue` without any config. the loading priority is as follows: |
| 52 | + |
| 53 | + - siteConfig |
| 54 | + - siteAgreement |
| 55 | + - themeEntryFile |
| 56 | + - themeAgreement |
| 57 | + - default |
| 58 | + |
| 59 | +* **$theme-default:** disable search box via frontmatter (close: [#1287](https://github.com/vuejs/vuepress/issues/1287)) ([#1288](https://github.com/vuejs/vuepress/issues/1288)) ([54e9eb0](https://github.com/vuejs/vuepress/commit/54e9eb0)) |
| 60 | + |
| 61 | + |
| 62 | + |
1 | 63 |
|
2 | 64 | <a name="1.0.0-alpha.37"></a>
|
3 | 65 | # [1.0.0-alpha.37](https://github.com/vuejs/vuepress/compare/v1.0.0-alpha.36...v1.0.0-alpha.37) (2019-02-08)
|
|
0 commit comments