首页 > 解决方案 > 如何在图像前向列表显示中使用 TouchWrapper 组件?

问题描述

在文档中,内容不足以准确实现 TouchWrapper 组件。有谁能帮忙吗?

我已经提到 - https://developer.amazon.com/docs/alexa-presentation-language/apl-touchwrapper.html

https://medium.com/@punkpocko/alexa-apl-touch-wrappers-75d62784b3e8

def can_handle(self, handler_input):
    return handler_input.request_envelope.request.type = 'Alexa.Presentation.APL.UserEvent' and handler_input.request_envelope.request.arguments.length>0 and (handler_input.request_envelope.request.arguments[0] == "Desi Flavors" or handler_input.request_envelope.request.arguments[0] == 'Global Flavors')

def handle(self, handler_input):
    if handler_input.request_envelope.request.arguments[0] == "Desi Flavors":
        dish ='Desi Flavors'
    elif handler_input.request_envelope.request.arguments[0] == "Global Flavors":
        dish ='Global Flavors'
    return dish

这是 JSON- { "type":"TouchWrapper", "item":{ "type":"Text", "text":"", "color":"", "fontSize":"" }, "OnPress ":{ "type":"SendEvent", "arguments":[ "Desi Flavors", "Global Flavors" ] }

}

我希望输出结果是,如果选择 Desi Flavors,它应该存储在变量(盘)中。

标签: pythonalexaalexa-skills-kitalexa-presentation-language

解决方案


推荐阅读