All files / src/progress/_example ProgressLineExample.jsx

77.78% Statements 7/9
100% Branches 0/0
66.67% Functions 4/6
85.71% Lines 6/7

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 24        1x   1x 1x       1x     1x   1x              
import React, { useState, useEffect } from "react";
import { Progress } from "@tencent/tea-component/lib/progress";
 
export default function ProgressCircleExample() {
  const [percent, setPercent] = useState(0);
 
  useEffect(() => {
    const timer = setInterval(
      () => setPercent(percent => (percent % 100) + 10),
      1000
    );
    return () => clearInterval(timer);
  }, []);
 
  return (
    <>
      <Progress percent={percent} text={percent => `${percent} %`} />
      <Progress percent={30} theme="default" text="运行中" />
      <Progress percent={60} theme="danger" text="运行失败" />
      <Progress percent={90} theme="success" text="运行成功" />
    </>
  );
}