I started a project using Express and Handlebars and then was encouraged to look at Vue.js.
(我使用Express和Handlebars开始了一个项目,然后被鼓励查看Vue.js。)
I am still at the stage of reading the docs but so far can't understand how to have layouts, partials and sections in Vue.js.(我仍处于阅读文档的阶段,但到目前为止还无法理解如何在Vue.js中使用布局,局部和部分。)
I think a partial would be a component, but I'm lost how to have a layout with partials and sections that I can inject content into.(我认为局部将是一个组件,但是我迷失了如何将局部和部分布局放入可以注入内容的布局。)
This is what I do using npm express-handlebars
in a file called baselayout.hbs
:
(这就是我在名为baselayout.hbs
的文件中使用npm express-handlebars
进行的操作:)
<!doctype html>
<html lang="en">
<head>
{{> global/headcode }} <!-- partial view with code for the head tag. it has stuff like favicon links --->
{{{_sections.pagemeta}}} <!-- page specific metadata injected here. this would be meta keywords description etc for a page/view --->
</head>
<body>
<div>
{{> global/siteheader }} <!--- partial view for the site's header --->
<div id="base-Container">
<main id="base-Content" role="main">
{{{ body }}} <!--- a page's main body content goes here --->
</main>
</div>
</div>
{{> sitefooter }}
{{{_sections.pagescripts}}} <!-- section for page-specific scripts injected here --->
</body>
</html>
How could I setup something like the above in Vue.js that would also work with server-side rendering?
(如何在Vue.js中设置类似上述内容的内容,使其也可以与服务器端渲染一起使用?)
I just need a base layout with header/footer components included but also sections into which page-specific content can go.(我只需要一个包含页眉/页脚组件的基本布局,还需要一些页面特定内容可以进入的部分。)
ask by volume one translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…