twig - amp-list src url 未获取数据
问题描述
我在 twig 文件中使用 amp-list 来创建选择下拉列表。但是树枝文件为{{#countries}}行 抛出了一个错误Unexpected character "#"。当此行被注释掉时,url 会正确获取数据。请看下面的代码:-
<section class="card">
<h2>Country</h2>
<amp-list src="https://ampbyexample.com/json/cart.json" layout="fixed-height" height="80" >
<template type="amp-mustache">
<label for="country">Countries</label>
<select id="country"
on="
change:
AMP.setState({
countries: dropdown.items[0].countries.filter(x => x.profileTitle == event.value)[0]
})">
<option value="">Choose a country</option>
{{#countries}}
<option value="{{name}}">{{name}}</option>
{{/countries}}
</select>
</template>
</amp-list>
</section>
我应该在 amp-list 中添加一些东西来告诉它等到数据被获取还是 {{#countries}} 模式在 twig 中不可用?非常感谢任何帮助。提前致谢。
解决方案
推荐阅读
- python-3.x - 如何在机器人框架中存储从列表返回的值应该包含子列表?
- django - 如何将列表从后端发送到 django 模板?
- javascript - 使用浏览器的导入编译 TypeScript 文件
- css - React Select:如何用我自己的图像替换 loadingIndicator 点
- c# - 如何将项目添加到我自己创建的控件
- javascript - 将类中的状态转换为反应中的功能的问题
- image - Flutter:什么样的参数类型可以分配参数类型“图像函数(动态)”?
- xamarin.forms - 如何在 Xamarin Forms 中的 ArcGIS Runtime 中为 TextSymbol 设置 FontFamily
- bash - 如何将参数传递到 xargs EOF
- python - Matplotlib 曲面图的数据排序