如何在 AMP 页面中使用 onclick 调用函数

how to call a function with onclick in AMP page

尝试在按下图像时调用 fetch api,看起来我检查了 AMP events 文档,但无济于事..

amp 内容如下所示;

  const callFetchAPI = () => {
    fetch('https://preview.amp.dev/static/samples/json/examples.json').then(
      (response) => response.json()
    )
  }
return (
                <a
                  target="_blank"
                  on="tap:callFetchAPI"
                  href="https://yahoo.com"
                >
                  <amp-img
                    role="button"
                    tabIndex={0}
                    id="clickEvent"
                    width="320"
                    height="150"
                    src={myurl}
                    alt=""
                    className="w-100"
                    layout="responsive"
                  />
                </a>

如何在按下时触发上面的功能?

ON 选项卡无法点击

{
  "content": "<div class="locked-msg-outer"><div class="mm-container"><div class="locked-msg-container subplan-container"><div class="locked-msg-container-in subplan-container-in"> <div class="locked-container-title">title </div><p class="locked-container-sub">title<p><div class="locked-btn-wrp" **on="tap:amp-access.login-ampArtileAccess-sign-in"** role="button" tabindex="0"><div class="btn btn-red ssoevksign-up">Login</div></div> </div> </div></div> <div class="locked-msg-overlay"></div></div>"
}