【问题标题】:When "absend" condition in Alexa APL当 Alexa APL 出现“缺席”条件时
【发布时间】:2019-09-30 11:04:00
【问题描述】:

我有一个数据结构,如果我想显示它,它可以选择保存一个值。在我的示例中,它是“数量”字段。但是,如果设置了它,将显示两个块而不是只显示一个。哪里出错了?

{
  "when": "${data.quantity === undefined}",
  "type": "Text",
  "text": "for ${data.price}",
  "style": "textStyleDetails"
},
{
  "when": "${data.quantity >= 0}",
  "type": "Text",
  "text": "${data.quantity}x for ${data.price}",
  "style": "textStyleDetails"
},

我也试过条件:

  • data.quantity == 'undefined'
  • !data.quantity
  • (typeOf data.quantity) === 'undefined'

它们都不起作用。

【问题讨论】:

    标签: alexa alexa-presentation-language


    【解决方案1】:

    尝试使用 ${data.quantity == null} Null 是 APL 数据绑定语法中公认的常量:https://developer.amazon.com/docs/alexa-presentation-language/apl-data-binding-syntax.html#null。 APL 也不支持 '===' 运算符。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-05-18
      • 1970-01-01
      • 1970-01-01
      • 2017-06-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多