vitepress icon indicating copy to clipboard operation
vitepress copied to clipboard

layout-slots don't support top-level-await

Open alamhubb opened this issue 2 years ago • 2 comments

Describe the bug

https://vitepress.vuejs.org/guide/theme-introduction#layout-slots

I wrote a custom component with reference to myLayout, I used top-level-await in the component, and then the view could not be displayed

I'm not sure if this issue is related to the following issues

https://github.com/vuejs/vitepress/issues/599

alamhubb avatar Aug 23 '22 13:08 alamhubb

Using top-level await will make Layout an async component, then we'll need Suspense to properly render it (which is experimental BTW). It would be better to just create an async component for your slot and use suspense only inside named template instead of using it for whole layout. Alternatively, use something like refs and onBeforeMount to accomplish whatever you want.

brc-dd avatar Aug 23 '22 13:08 brc-dd

能否将doc左侧的sidebar也做成插槽,并且将sidebar的数据暴漏出来,供外部使用

didoee avatar Sep 09 '22 08:09 didoee