All files / src/segment/_example SegmentMultipleExample.jsx

50% Statements 2/4
100% Branches 0/0
33.33% Functions 1/3
66.67% Lines 2/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23        1x   1x                                
import React, { useState } from "react";
import { SegmentMultiple } from "@tencent/tea-component/lib/segment";
 
export default function SegmentMultipleExample() {
  const [value, setValue] = useState([2, 4]);
 
  return (
    <SegmentMultiple
      value={value.map(String)}
      onChange={value => setValue(value.map(x => parseInt(x, 10)))}
      options={[
        { text: "日", value: "0", disabled: true, tooltip: "仅支持工作日" },
        { text: "一", value: "1" },
        { text: "二", value: "2" },
        { text: "三", value: "3" },
        { text: "四", value: "4" },
        { text: "五", value: "5" },
        { text: "六", value: "6", disabled: true, tooltip: "仅支持工作日" },
      ]}
    />
  );
}