Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix($theme-default): Fix slots syntax #1964

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/@vuepress/core/lib/node/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ module.exports = class App {
.use(require('./internal-plugins/frontmatterBlock'))
.use('container', {
type: 'slot',
before: info => `<template #${info}>`,
before: info => `<template slot="${info}">`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is still working fine since this is a <template>

after: '</template>'
})
.use('container', {
Expand Down
8 changes: 4 additions & 4 deletions packages/@vuepress/theme-default/layouts/Layout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@
>
<slot
name="sidebar-top"
#top
slot="top"
/>
Comment on lines 22 to 25
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The new v-slot syntax can only be added to a <template>, so the code below should fix it

<template #top>
  <slot name="sidebar-top"/>
</template>

<slot
name="sidebar-bottom"
#bottom
slot="bottom"
/>
</Sidebar>

Expand All @@ -37,11 +37,11 @@
>
<slot
name="page-top"
#top
slot="top"
/>
<slot
name="page-bottom"
#bottom
slot="bottom"
/>
</Page>
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/@vuepress/theme-vue/layouts/Layout.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<ParentLayout>
<CarbonAds #sidebar-top/>
<BuySellAds #page-bottom/>
<CarbonAds slot="sidebar-top"/>
<BuySellAds slot="page-bottom"/>
Comment on lines -3 to +4
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can only use the new v-slot on the component when name is default

<template #sidebar-top>
  <CarbonAds/>
</template>

</ParentLayout>
</template>

Expand Down