Slack static_select 避免更改时后端调用

Pet*_*ran 3 slack-api

我有一个带有 static_select 的松弛模态

{
      block_id: "my_block_id",
      type: "section",
      text: {
        type: "mrkdwn",
        text: "Please select one"
      },
      accessory: {
        type: "static_select",
        action_id: "select_type",
        placeholder: {
          type: "plain_text",
          text: "Select one"
        },
        options: self.types_options
      }
    },
Run Code Online (Sandbox Code Playgroud)

当用户选择其中一个选项时,会触发后端调用,我可以避免这种情况并在单击提交表单按钮时触发调用吗?

Nic*_*vey 6

把你的static_select放在里面 ainput而不是 a section

当有人在应用程序的模式视图中使用交互式组件时,应用程序将收到 block_actions 有效负载。

这不适用于输入块中包含的组件(有关这些组件的详细信息,请参见下文)。

https://api.slack.com/surfaces/modals/using#components

输入块中使用的任何交互式组件都不会发送此 block_actions 有效负载。它们仅包含在 view_submission 有效负载中。

https://api.slack.com/reference/interaction-payloads/block-actions