如何使用 NextJs 添加 AMP 用户事件

How to add AMP User Events with NextJs

提问人:Abhishek Kumbhani 提问时间:11/6/2023 更新时间:11/6/2023 访问量:9

问:

<amp-script layout="container" script="hello-world">
    <div style={{ width: "90%" , display: "flex" , justifyContent: "end" , alignItems: "center" , marginBottom: 10,
      cursor: "pointer" , on="tap:hello-world.xyz" tabindex="0" role="button">
      Report this Job
    </div>
  </amp-script>

  <script id="hello-world" type="text/plain" target="amp-script">
    `function xyz() {
      console.log("Clicked!!")
    `}
  </script>

我想调用这个在脚本标签中定义的 xyz 函数,它应该为用户做一些事情,例如导航到不同的页面或获取一些新数据等......

目前,当我单击此div时,我收到错误,上面写着

[Action] Target ( SCRIPT ) doesn't support "xyz" action.

(https://i.stack.imgur.com/ZfhDK.png)

事件 下一个.js 单击 异步消息传递协议

评论


答: 暂无答案