vite-plugin-vue-layouts
vite-plugin-vue-layouts copied to clipboard
not work with tsx
It dosn't render my layout, always render default layout. And render the meta tag text.
export default defineComponent({
setup() {
return () => <>
<route lang="yaml">
meta:
layout: home
</route>
</>
},
})

Is this code equivalent to template effective
无效的。vite-plugin-vue-layouts 不能用 tsx 中。
I tried to change the layout by changing route.meta.layout, but it still does not work.
export default defineComponent({
setup() {
const route = useRoute()
route.meta.layout = 'home'
return () => (
<>...</>
)
}
}
https://github.com/hannoeru/vite-plugin-pages#jsxtsx-yaml-format-comments-for-route-datain-vue
Maybe we should turn to the docs of vite-plugin-pages.
You can add a block comment in the JSX/TSX file like below
/*
route
meta:
layout: home
*/
You can add a block comment in the JSX/TSX file like below
/* route meta: layout: home */
Ok,i read the docs of vite-plugin-pages about parse YAML,But i dont try it. Have you try it?Is it working right?
Ok,i read the docs of vite-plugin-pages about parse YAML,But i dont try it. Have you try it?Is it working right?
It works fine, and you can try the repo widcardw/vue-tsx-starter, the index page is applied with home layout. I forgot to deploy it to netlify, but it does work in dev mode.
Ok,i read the docs of vite-plugin-pages about parse YAML,But i dont try it. Have you try it?Is it working right?
It works fine, and you can try the repo widcardw/vue-tsx-starter, the index page is applied with home layout. I forgot to deploy it to netlify, but it does work in dev mode.
Ok,i will try it. Thank you very much.