【问题标题】:Specify valid default value for [disabled] property on AMP page amp-bind为 AMP 页面 amp-bind 上的 [disabled] 属性指定有效的默认值
【发布时间】:2018-02-21 19:43:11
【问题描述】:

使用 amp-bind 时,我收到以下错误:

Default value for <input [disabled]="ampState.success"> does not match
first result (). We recommend writing expressions with matching
default  values, but this can be safely ignored if intentional.

我的初始状态是:

  <amp-state id="ampState">
    <script type="application/json">
      {
        // ...
        "success": "",
      }
    </script>
  </amp-state>

而有问题的元素是:

<input type="submit" <!-- .... --> [disabled]="ampState.success" />

考虑到我不能[disabled] 提供默认值而不实际禁用输入吗?

【问题讨论】:

    标签: html amp-html


    【解决方案1】:

    我发现这个警告可以通过如下设置状态来避免:

      <amp-state id="ampState">
        <script type="application/json">
          {
            // ...
            "success": "",
          }
        </script>
      </amp-state>
    

    当 AMP 验证器查找 actualValue === expectedValue 时,禁用的属性 initial actualValue 实际上是 false,而不是 ''

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多