当我在Submit-success事件上提交表单时,我试图提交另一张表单,但是这会导致信任级别错误,表明submit-success没有相同的信任级别来设置状态。 我检查了amp-form提交事件和setState事件具有与HIGH相同的信任级别,但没有找到提交成功事件的信任级别
"submit-success" event with "low" trust is not allowed to invoke "amp.setState".
虚拟示例
<form id="f1" method="POST" xhr-action="dummyapi" on="submit-success:AMP.setState({dummy:true})">
<!--fields-->
</form>
<form id="f2" method="POST" xhr-action="dummyapi" on="submit-success:f1.submit">
<!--fields-->
</form>
提交f1表单时的setState无效
答案 0 :(得分:0)
好友,您的代码在哪里?为什么不能插入简单的有效AMP模板?您可能希望有人为您做任何事情,但这不会总是发生。
我试图做你写的东西,一切对我都有用,
public static void PrintList()
{
var actions = new List<Action>();
var listaInt = new List<int>();
for (int i = 0; i < 5; i++)
{
listaInt.Add(i);
var entries = string.Join(",", listaInt.Select(d => string.Format("{0}", string.Join(",", d))));
actions.Add(() => Console.WriteLine("counterList: " + entries));
}
foreach (var action in actions)
{
action();
}
}
Codepen: https://codepen.io/alexandr-kazakov/pen/wvGJvzJ?editors=1000