对于有限的选项,您不必使用amp-list,它用于动态下拉菜单。您可以使用amp-bind来实现您的目标。
这是工作网址
代码:
<!doctype html>
<html ⚡>
<head>
<meta charset="utf-8">
<title> AMP amp-bind </title>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script>
<link rel="canonical" href="https://ampbyexample.com/introduction/hello_world/">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-custom>
</style>
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}@-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}@keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
</head>
<body>
<select on="change:AMP.setState({ option: event.value })" data-type="text" id="cuisine" name="cuisine" required>
<option value="german">German wine</option>
<option value="baden">Baden cuisine</option>
<option value="hamburg">Hamburg cuisine</option>
<option value="others">Others</option>
</select>
<div hidden [hidden]="option != 'others'" class="form-group hide" id="other_cusone">
<label for="other_city_p" class="active">Other :</label>
<input type="text" id="other_c_p" name="other" placeholder="Other">
</div>
</body>
</html>