2187b3d2 by niexq

feat: add Gauge demo

0 parents
1 /node_modules
2 /.env.local
3 /.umirc.local.ts
4 /config/config.local.ts
5 /src/.umi
6 /src/.umi-production
7 /src/.umi-test
8 /dist
9 .swc
1 registry=https://registry.npmmirror.com/
2
1 import { defineConfig } from "umi";
2
3 export default defineConfig({
4 routes: [
5 { path: "/", component: "index" },
6 // { path: "/docs", component: "docs" },
7 ],
8 npmClient: 'pnpm',
9 });
1 # 压力表盘自动生成系统
2
3 ## 开发
4
5 ```
6 pnpm install
7
8 pnpm dev
9 ```
1 {
2 "private": true,
3 "author": "niexq <niexq0319@gmail.com>",
4 "scripts": {
5 "dev": "umi dev",
6 "build": "umi build",
7 "postinstall": "umi setup",
8 "setup": "umi setup",
9 "start": "npm run dev"
10 },
11 "dependencies": {
12 "@ant-design/charts": "^0.9.13",
13 "umi": "^4.3.20"
14 },
15 "devDependencies": {
16 "@types/react": "^18.0.33",
17 "@types/react-dom": "^18.0.11",
18 "typescript": "^5.0.3"
19 }
20 }
This diff could not be displayed because it is too large.
1 .navs {
2 ul {
3 padding: 0;
4 list-style: none;
5 display: flex;
6 }
7 li {
8 margin-right: 1em;
9 }
10 }
1 import { Link, Outlet } from 'umi';
2 import styles from './index.less';
3
4 export default function Layout() {
5 return (
6 <div className={styles.navs}>
7 <Outlet />
8 </div>
9 );
10 }
1 import { Gauge } from '@ant-design/charts';
2
3 const DemoGauge: React.FC = () => {
4 const config = {
5 title: {
6 visible: false,
7 text: '压力表',
8 },
9 width: 400,
10 height: 400,
11 value: 0.75,
12 min: 0,
13 max: 1.6,
14 range: [0, 0.4, 0.8, 1.2, 1.6],
15 statistic: {
16 visible: true,
17 text: '压力表',
18 color: '#faad14',
19 },
20 color: ['#39B8FF', '#52619B', '#43E089', '#C0EDF3'],
21 format: (v: number) => {
22 return Number(v).toFixed(1);
23 },
24 };
25 return <Gauge {...config} />;
26 };
27
28 export default DemoGauge;
...\ No newline at end of file ...\ No newline at end of file
1 const DocsPage = () => {
2 return (
3 <div>
4 <p>This is umi docs.</p>
5 </div>
6 );
7 };
8
9 export default DocsPage;
1 import Gauge from './Gauge';
2
3
4 export default function HomePage() {
5 return (
6 <Gauge />
7 );
8 }
1 {
2 "extends": "./src/.umi/tsconfig.json"
3 }
1 import 'umi/typings';
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!