是否可以在AMP中的选择事件上运行一些自定义JS?
所选内容已添加自动完成功能。我们希望将所选项目的 ID 保存到单独的隐藏字段中。
是的。 你可以用amp-script
: https://amp.dev/documentation/components/amp-script/
您还可以使用AMP.setState
更改状态并绑定到自动完成的 amp 事件。
退房amp-bind
: https://amp.dev/documentation/components/amp-bind/.Actions and Events
: https://amp.dev/documentation/guides-and-tutorials/learn/amp-actions-and-events/