当我将按钮放入旋转木马时会出错

问题描述 投票:0回答:1

它产生错误,使我退出应用程序。当我按下所选项目时,我想转到youtube链接。当我删除按钮时,它可以工作,但不会进入链接网址。

    conv.ask(new Carousel({
        items: {
            'item 1': {
                title: 'item 1',
                buttons: new Button({
                    title: 'This is a button',
                    url: 'https://www.youtube.com/',
                }),
                url: 'https://www.youtube.com/',
                description: 'Description of item 1',
                image: new Image({
                    url: 'https://www.youtube.com/',
                    alt: 'aa',
                })
            },

            'item 2': {
                title: 'item 2',
                buttons: new Button({
                    title: 'This is a button 2',
                    url: 'https://www.youtube.com/',
                }),
                url: 'https://www.youtube.com',
                description: 'Descript',
                image: new Image({
                    url: 'https://www.youtube.com/',
                    alt: 'item 2',
                })
            },
        },
    }));    
actions-on-google
1个回答
0
投票

[如果您想要一组带有链接的项目,则需要使用BrowseCarousel而不是常规轮播。请记住,BrowseCarousel没有按钮。

conv.ask(new BrowseCarousel({
    items: [
      new BrowseCarouselItem({
        title: 'Title of item 1',
        url: 'https://example.com',
        description: 'Description of item 1',
        image: new Image({
          url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png',
          alt: 'Image alternate text',
        }),
        footer: 'Item 1 footer',
      }),
      new BrowseCarouselItem({
        title: 'Title of item 2',
        url: 'https://example.com',
        description: 'Description of item 2',
        image: new Image({
          url: 'https://storage.googleapis.com/actionsresources/logo_assistant_2x_64dp.png',
          alt: 'Image alternate text',
        }),
        footer: 'Item 2 footer',
      }),
    ],
  }));
© www.soinside.com 2019 - 2024. All rights reserved.