chenquincy/vue-dynamic-form-component

enum 怎么做数据联动

iceqi opened this issue · 1 comments

iceqi commented
descriptors: {
        array: {
          type: 'array',
          label: this.label,
          defaultField: {
            type: 'object',
            fields: {
              'category': {
                type: 'enum',
                label: '选择分类',
                enum: this.options,
                options: this.options.map((item, index) => {
                  return {
                    label: item.name,
                    value: item.id,
                    key: index
                  }
                }),
                events: {
                  change: (v) => {
                    this.params.category = v
                    this.productList()
                  }
                }
              },
              groups: { type: 'string', required: true, label: '产品组' },
              products: {
                type: 'array',
                label: '添加产品',
                defaultField: {
                  type: 'object',
                  fields: {
                    max_num: { label: '最大使用次数', type: 'number', required: true },
                    product: {
                      type: 'enum',
                      label: '选择产品',
                      // enum: !this.data.products,
                      options: this.options.map((item, index) => {
                        return {
                          label: item.name,
                          value: item.id,
                          key: index
                        }
                      }),
                      events: {
                        change: (v) => {
                          console.log()
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }

只贴了个 descriptor ,没太明白你想要怎么做联动。麻烦描述清楚你的需求。