Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
b15f09c27c | |||
b051c59e9e |
@@ -1,13 +1,10 @@
|
|||||||
import { defineConfig } from 'umi';
|
import { defineConfig } from 'umi';
|
||||||
|
import routes from './routes'
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
nodeModulesTransform: {
|
nodeModulesTransform: {
|
||||||
type: 'none', // all 慢 兼容好
|
type: 'none', // all 慢 兼容好
|
||||||
},
|
},
|
||||||
routes: [
|
routes,
|
||||||
{ path: '/', component: '@/pages/index' },
|
|
||||||
{ path: '/about', component: '@/pages/about' },
|
|
||||||
],
|
|
||||||
fastRefresh: {},
|
fastRefresh: {},
|
||||||
history: {
|
history: {
|
||||||
type: 'browser'
|
type: 'browser'
|
||||||
|
4
config/routes.ts
Normal file
4
config/routes.ts
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
export default [
|
||||||
|
{ path: '/', component: '@/pages/index' },
|
||||||
|
{ path: '/about', component: '@/pages/about' },
|
||||||
|
]
|
13
src/components/Box.tsx
Normal file
13
src/components/Box.tsx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
import {useState} from "react";
|
||||||
|
import { Button } from 'antd'
|
||||||
|
export function BoxDiv(){
|
||||||
|
let [number, setNumber] = useState(0)
|
||||||
|
function clickHandler(){
|
||||||
|
setNumber(number+1);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (<div>
|
||||||
|
<h1>Box-{number}</h1>
|
||||||
|
<Button onClick={ clickHandler }>+</Button>
|
||||||
|
</div>)
|
||||||
|
}
|
@@ -1,10 +1,12 @@
|
|||||||
import styles from './index.less';
|
import styles from './index.less';
|
||||||
import { Button } from 'antd'
|
import { Button } from 'antd'
|
||||||
|
import { BoxDiv } from '@/components/Box'
|
||||||
export default function IndexPage() {
|
export default function IndexPage() {
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
<h1 className={styles.title}>Page index</h1>
|
<h1 className={styles.title}>Page index</h1>
|
||||||
<Button type={"primary"}>Click</Button>
|
<Button type={"primary"}>Click</Button>
|
||||||
|
<BoxDiv></BoxDiv>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user