alibaba / x-render

🚴‍♀️ 阿里 - 很易用的中后台「表单 / 表格 / 图表」解决方案
https://xrender.fun
7.01k stars 993 forks source link

drawerlist的点击删除按钮和点击弹出框的确定按钮的触发事件如何处理 #1528

Closed kt7456 closed 2 months ago

kt7456 commented 3 months ago

df8cc6e4f558e6897033887aef766ed f1c98fa71b06105551969f88e8556f7

Hemyhcy commented 3 months ago

1.点击弹出框的确定按钮的触发事件暂时没有暴露出来 2.删除按钮的触发事件为onRemove 示例如下:

const schema = {
  type: 'object',
  displayType: 'row',
  properties: {
    list: {
      title: '对象数组',
      description: '对象数组嵌套功能',
      type: 'array',
      widget: 'drawerList',
      props: {
        onRemove: (operation, { schema, data, index }) => {
          console.log("点击删除按钮回调函数", { schema, data, index })
        },
      },
      items: {
        type: 'object',
        properties: {
          input1: {
            title: '简单输入框',
            type: 'string',
            required: true,
          },
          input2: {
            title: '简单输入框2',
            type: 'string',
          },
          input3: {
            title: '简单输入框3',
            type: 'string',
          },
          select1: {
            title: '单选',
            type: 'string',
            enum: ['a', 'b', 'c'],
            enumNames: ['早', '中', '晚'],
            widget: 'select',
          },
        },
      },
    },
  },
};