小编Ani*_*Ani的帖子

AMP 表单 - 在表单提交后显示相同的 html 并添加一些附加元素

我正在使用 AMP 表单,无法弄清楚如何在使用一些附加元素提交表单后显示相同的 html。

一般来说,我的标记比较复杂,但这里有简单的示例来说明我需要做什么:

<form method="post" action-xhr="https://example.com/subscribe" target="_top" id="form1">
  <ul>
    <li>
        <h2>Title 1</h2>
        <input type="radio" value="1" name="answer" id="1" on="change:form1.submit">
        <!-- Show this only on submit-success and there are used
             some variables from amp-mustache -->                       
        <div>Some Html {{Votes}}</div>
    </li>

    <li>
        <h2>Title 2</h2>                                    
        <input type="radio" value="2" name="answer" id="2" on="change:form1.submit">
        <!-- Show this only on submit-success and there are used
             some variables from amp-mustache -->               
        <div>Some Html {{Votes}}</div>
    </li>       
    ...
  </ul>

</form>
Run Code Online (Sandbox Code Playgroud)



我知道我可以使用这样的东西,但不想重复标记(正如我提到的,它比提供的示例更复杂):

<form method="post" action-xhr="https://example.com/subscribe" target="_top" id="form1">
  <ul>
    <li>
        <h2>Title 1</h2> …
Run Code Online (Sandbox Code Playgroud)

amp-html accelerated-mobile-page

2
推荐指数
1
解决办法
2345
查看次数

标签 统计

accelerated-mobile-page ×1

amp-html ×1