From fe70f35703c4b2675b048f42e2d6bff145c4e814 Mon Sep 17 00:00:00 2001 From: yanzuoguang Date: Sat, 8 Nov 2025 11:19:56 +0800 Subject: [PATCH] =?UTF-8?q?fix(layout):=E4=BF=AE=E5=A4=8D=E5=B8=83?= =?UTF-8?q?=E5=B1=80=E6=A8=A1=E6=9D=BF=E6=89=A7=E8=A1=8C=E6=97=B6=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=BC=A0=E9=80=92=E9=97=AE=E9=A2=98-=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=20ExecuteTemplate=20=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E8=B0=83=E7=94=A8=EF=BC=8C=E7=A1=AE=E4=BF=9D=E5=B8=83=E5=B1=80?= =?UTF-8?q?=E6=A8=A1=E6=9D=BF=E8=83=BD=E6=AD=A3=E7=A1=AE=E6=8E=A5=E6=94=B6?= =?UTF-8?q?=E5=8E=9F=E5=A7=8B=E6=95=B0=E6=8D=AE=20-=20=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=20product=5Flist.html=20=E6=A8=A1=E6=9D=BF=E4=B8=AD=E7=9A=84?= =?UTF-8?q?=E5=8D=A0=E4=BD=8D=E7=AC=A6=E5=86=85=E5=AE=B9-=20=E5=9C=A8=20st?= =?UTF-8?q?ore=5Flayout.html=20=E4=B8=AD=E6=B7=BB=E5=8A=A0=20body=20?= =?UTF-8?q?=E5=8D=A0=E4=BD=8D=E7=AC=A6=E4=BB=A5=E6=94=AF=E6=8C=81=E5=86=85?= =?UTF-8?q?=E5=AE=B9=E6=8F=92=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 32-platform/platform/templates/layout_executor.go | 2 +- 32-platform/sportsstore/templates/product_list.html | 6 +++++- 32-platform/sportsstore/templates/store_layout.html | 2 ++ 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/32-platform/platform/templates/layout_executor.go b/32-platform/platform/templates/layout_executor.go index abe1ac7..c1cfa79 100644 --- a/32-platform/platform/templates/layout_executor.go +++ b/32-platform/platform/templates/layout_executor.go @@ -38,7 +38,7 @@ func (proc *LayoutTemplateProcessor) ExecTemplateWithFunc(writer io.Writer, name err = localTemplates.ExecuteTemplate(&sb, name, data) if layoutName != "" { // 通过布局模板加载内容 - err = localTemplates.ExecuteTemplate(writer, layoutName, sb.String()) + err = localTemplates.ExecuteTemplate(writer, layoutName, data) } else { _, err = io.WriteString(writer, sb.String()) } diff --git a/32-platform/sportsstore/templates/product_list.html b/32-platform/sportsstore/templates/product_list.html index 2210d91..20567f4 100644 --- a/32-platform/sportsstore/templates/product_list.html +++ b/32-platform/sportsstore/templates/product_list.html @@ -8,4 +8,8 @@ {{ define "right_column" }} Put something useful here -{{ end }} \ No newline at end of file +{{ . }} +{{ end }} + + +{{ . }} \ No newline at end of file diff --git a/32-platform/sportsstore/templates/store_layout.html b/32-platform/sportsstore/templates/store_layout.html index f98b897..396b8ae 100644 --- a/32-platform/sportsstore/templates/store_layout.html +++ b/32-platform/sportsstore/templates/store_layout.html @@ -18,6 +18,8 @@
{{ template "right_column" . }}
+ + {{ body }} \ No newline at end of file