我有一个非常简单的AMP页面,它使用amp-bind。但是,验证器总是显示以下消息:
扩展名'amp-bind‘已在此页面中找到,但未使用。请删除这个分机。“
我的页面确实使用了amp-bind。该页的代码如下:
<!doctype html>
<html ⚡>
<head>
<meta charset="utf-8">
<script async src="https://cdn.ampproject.org/v0.js"></script>
<link rel="canonical" href="http://localhost/amp-bind.html" />
<title>AMP bind test</title>
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<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>
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script>
</head>
<body class="main">
<h3>amp-bind example</h3>
<p [text]="'Hello '+username">Hello World</p>
<button on="tap:AMP.setState({username: 'rodders'})">Say Hello</button>
</body>
</html>有人能解释一下为什么这条消息会显示出来吗?我能做些什么来删除它呢?
发布于 2017-07-21 16:13:57
这是一个最近修正的bug。解决方法是在页面中包含一个<amp-state>元素。真对不起!
https://stackoverflow.com/questions/45132400
复制相似问题