Reactjs 如何动态填充查询生成器列表?

Reactjs 如何动态填充查询生成器列表?,reactjs,debugging,Reactjs,Debugging,我使用下面的代码使用数据库中的列表值动态填充查询生成器。当我运行此代码并激活下拉列表时,它表示没有数据 我已经研究了JSON格式,它看起来与Github()上示例中的预制配置文件相同。有没有办法动态地填写列表?如果是的话,是否有明显的问题 const loadMetricConfigFields = async () => { let fields = {}; const result = await FetchData(url); // Set up the

我使用下面的代码使用数据库中的列表值动态填充查询生成器。当我运行此代码并激活下拉列表时,它表示没有数据

我已经研究了JSON格式,它看起来与Github()上示例中的预制配置文件相同。有没有办法动态地填写列表?如果是的话,是否有明显的问题

const loadMetricConfigFields = async () => {
    let fields = {};

    const result = await FetchData(url);

    // Set up the category fields that will hold the metrics
    result.forEach(element => {
      fields[`${element.categoryName}`] = {
        label: element.categoryName,
        subfields: {},
        tooltip: 'tooltip',
        type: '!struct'
      };
    });

    for (let count = 0; count < result.length; count++) {
      // Set up the subfields first
      fields[`${result[count].categoryName}`]['subfields'][count] = {
        label: result[count].name,
        type: result[count].uiComponentName.toLowerCase(),
        valueSources: ['value', 'field'],
        operators: [],
        fieldSettings: {},
        widgets: {
          field: {},
          number: {
            widgetProps: {}
          },
          rangeSlider: {},
          slider: {}
        },
        mainWidget: 'number',
        defaultOperator: ''
      };

      const operators = await FetchData(url + endpoint + result[count].dataTypeId);

      // Set up the operators for each subfield
      operators.forEach(op => {
        fields[`${result[count].categoryName}`]['subfields'][count]['operators'].push(op.name);
      })

      // Set up the defaultOperator for each subfield
      fields[`${result[count].categoryName}`]['subfields'][count]['defaultOperator'] = operators[0].name;
    }

    await setConfigFields(fields);
  }
const loadMetricConfigFields=async()=>{
让字段={};
const result=等待获取数据(url);
//设置将保存度量的类别字段
result.forEach(元素=>{
字段[`${element.categoryName}`]={
标签:element.categoryName,
子字段:{},
工具提示:“工具提示”,
类型:“!struct”
};
});
for(让count=0;count{
字段[`${result[count].categoryName}`]['subfields'][count]['operators'].push(op.name);
})
//为每个子字段设置defaultOperator
字段[`${result[count].categoryName}`]['subfields'][count]['defaultOperator']]=运算符[0]。名称;
}
等待设置配置字段(字段);
}