[CMS-VISUAL] F2: 门户布局区块输出稳定 id + data-plb-id 锚点(display:contents 零布局影响)+ postMessage 预览监听脚本(门户侧 50 测试绿)

This commit is contained in:
chenxing
2026-09-28 12:52:45 +08:00
parent c60f9dffb7
commit 089cb54011
5 changed files with 69 additions and 3 deletions
@@ -30,7 +30,9 @@
注意坑④:th:replace(优先级 100)先于 th:case(300)执行——case 必须放父元素、replace 放子元素。 -->
<th:block th:if="${layoutBlocks != null}">
<th:block th:replace="~{'themes/common/fragments/home-blocks' :: style}" />
<th:block th:replace="~{'themes/common/fragments/home-blocks' :: previewScript}" />
<th:block th:each="block : ${layoutBlocks}">
<div class="plb-anchor" th:attr="data-plb-id=${block['id']}" style="display:contents">
<th:block th:switch="${block.type}">
<th:block th:case="'article_list'">
<th:block th:switch="${block.homeStyle}">
@@ -48,6 +50,7 @@
<th:block th:case="'notice_bar'"><th:block th:replace="~{${themeBase} + '/fragments/home-blocks' :: notice_bar(${block})}" /></th:block>
<th:block th:case="*"><th:block th:replace="~{'themes/common/fragments/home-blocks' :: render(${block})}" /></th:block>
</th:block>
</div>
</th:block>
</th:block>