index.md 678 Bytes

title: 组件

排序规则

import React, { useState } from 'react';
import { QxSortCondition } from './index';
import {options1} from './mock';

export default () => {
  const [values, setValues] = useState<
    {
      key: string;
      asc: boolean;
    }[]
  >([
    {
      key: 'created_at',
      asc: false,
    },
  ]);

  const props = {
    onChange: (
      _val: {
        key: string;
        asc: boolean;
      }[],
    ) => {
      setValues(_val);
    },
    value: values,
    optionList: options1,
  };

  return <div style={{
    width: 400,
  }}>
    <QxSortCondition {...props} />
  </div>;
};
// <API id="QxSortCondition"></API>