export default () => {
  //根据产品获取对应属性
  const useByProductGetAttribute = (res, callback, opt) => {
    const getAttr = (options) =>
      callback({
        field: 'type2',
        componentProps: {
          placeholder: '请选择属性',
          options,
        },
      });
    if (Array.isArray(res)) {
      opt = res.map((m) => {
        return {
          label: m?.identifier,
          value: m?.identifier,
        };
      });
      getAttr(opt);
    } else {
      getAttr(opt);
    }
  };

  return {
    useByProductGetAttribute,
  };
};
