0

我正在使用 amp-list 调用一个 API,该 API 将 HTML 作为其响应的一部分,并使用 mustache 模板来呈现这样的 HTML {{{html-content}}}。JSON响应中的HTML是这样的

"<h1 class=\"h1_class\">Some Header h1</h1>\n<p class=\"p_class\">Content Para 1\n</p><h2 class=\"h2_class\">Some Header h2</h2><p class=\"p_class\">Some Para 2\n</p><h2 class=\"h2_class\">Some Another Header h2</h2><p class=\"p_class\">Content Para 2\n</p><h2 class=\"h2_class\">Some Header h2</h2><p class=\"p_class\">Some More Content</p>"

我在这里面临的问题是没有任何标题被渲染,并且没有任何标题类/标记在 DOM 中可见(标题仅显示为没有任何 h1 或 h2 标记的字符串)。如果我只使用其中的 HTML 内容调用 API,它将显示在带有“h1”、“h2”和“p”标记的 chrome 开发人员工具的响应选项卡中。我不确定这是 AMP 的限制,或者我将 JSON 中的 HTML 传递给 mustache 模板的方式是否有问题。

我将非常感谢在这方面的任何帮助。

4

1 回答 1

1

Currently you cannot do that. We try to convince them https://github.com/ampproject/amphtml/issues/17352 but not any help :).

于 2018-08-28T02:24:23.837 回答