Beego模板呈现局部

Is there a functionality to render partial templates in the Beego? I used this functionality in RoR.

Ruby on Rails partials: Partial templates - usually just called "partials" - are another device for breaking the rendering process into more manageable chunks. With a partial, you can move the code for rendering a particular piece of a response to its own file.

Example from RoR:

<!-- html.erb -->
<h1>New zone</h1>
<%= render partial: "form", locals: {zone: @zone} %>

and

<!-- _form.html.erb -->
<%= form_for(zone) do |f| %>
  <p>
    <b>Zone name</b><br>
    <%= f.text_field :name %>
  </p>
  <p>
    <%= f.submit %>
  </p>
<% end %>

Yes, though they are not explicitly referenced as partials in the documentation, you can compose templates like you described. From the documentation for views.

{{template "header.html"}}
  Logic code
{{template "footer.html"}}

Because Beego is an MVC framework, it will automatically look for your "partials" in the views directory.

If you had another subdirectory called views/base then your partial would look like this:

{{template "base/header.html" .}}

A good reference implementation that will provide more examples in the context of a real world app, check out the wetalk project on github