我无法使用amp-autcomplete,没有得到为什么会出现这样的错误

问题描述

这是我使用的代码,它是amp-autocomplete组件。 使用amp-autocomplete组件,我想根据用户选择选项进行重定向,但是我无法做到这一点。请提出一些建议。

  <form class="sample-form"
  method="post"
  action-xhr="https://amp.dev/documentation/examples/api/echo"
  target="_top">
  <label>
    <span>Search for</span>
    <amp-autocomplete  filter="token-prefix" filter-value="city"
      min-characters="1">
      <input type="search"
        name="city">
      <script type="application/json">
        {"items":[{"city":"Albany","state":"New York"},{"city":"Annapolis","state":"Maryland"},{"city":"Trenton","state":"New Jersey"}]}
      </script>
      <template type="amp-mustache"
        id="amp-template-custom">
        <div class="city-item"
          [text]="{{city}}">
          <div>{{text}}</div>
        </div>
      </template>
    </amp-autocomplete>
  </label>
</form>

并得到这些错误

error.js:204意外令牌和JSON在位置10

amp-autocomplete-0.1.js:formatted:593未捕获(已承诺)资源:无法构建:amp-autocomplete#1:意外令牌和JSON中的位置10

DevTools无法加载SourceMap:无法加载http:// localhost:4000 / ww.js.map的内容:HTTP错误:状态代码404,net :: ERR_HTTP_RESPONSE_CODE_FAILURE

试图搜索这些错误,但没有得到任何相关信息。

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)