1

我正在尝试 AMP 中的动态下拉列表,我能够获得输出,但其中一个下拉列表由于某种原因正在刷新。由于我是小胡子和 AMP 的新手,所以我无法弄清楚。

以下是输出的链接:https ://capellaamp.herokuapp.com/

部分代码:

<amp-list width="auto" height="25" layout="fixed-height" src="https://capellaamp.herokuapp.com/dropdown.json">
      <template type="amp-mustache">
        <select on="
            change:
              AMP.setState({
                test: dropdown.items[0].countries.filter(x => x.name == event.value)[0]
              })">
          <option value="">Choose Degree</option>
          {{#countries}}
          <option value="{{name}}">{{name}}</option>
          {{/countries}}
        </select>
      </template>
    </amp-list>
    <amp-list width="auto" height="25" layout="fixed-height" [src]="test || 'https://capellaamp.herokuapp.com/dropdown.json'" src="https://capellaamp.herokuapp.com/dropdown.json">
      <template type="amp-mustache">
        <select on="
            change:
              AMP.setState({
                test1: test.cities.filter(x => x.name == event.value)[0]
              })">
          <option value="">Choose AOS</option>
          {{#cities}}
          <option value="{{name}}">{{name}}</option>
          {{/cities}}
        </select>
      </template>
    </amp-list>
    <amp-list width="auto" height="25" layout="fixed-height" [src]="test1 || 'https://capellaamp.herokuapp.com/dropdown.json'" src="https://capellaamp.herokuapp.com/dropdown.json">
      <template type="amp-mustache">
        <select>
          <option value="">Choose Specialization</option>
          {{#cities}}
          <option value="{{name}}">{{name}}</option>
          {{/cities}}
        </select>
      </template>
    </amp-list>
    <amp-state id="dropdown" src="https://capellaamp.herokuapp.com/dropdown.json"></amp-state>

示例取自以下链接: https ://ampbyexample.com/playground/#url=https%3A%2F%2Fampbyexample.com%2Fadvanced%2Flinked_dropdowns%2Fsource%2F&mode=Responsive

4

0 回答 0