资料参考:
- https://langliu.github.io/posts/vite-component-library/
- icons: https://mui.com/material-ui/material-icons/
todo:
- [] 所有组件的ref的传递
- [] card
- [] h7 小一号
在前端项目中使用 npm
或者 yarn
命令进行安装
# use npm
npm install @xie-work/react-ui
# use yarn
yarn add @xie-work/react-ui
import {Button} from '@xie-work/react-ui'
const App = () => {
return (
<div>
<Button>这是一个按钮 < /Button>
< /div>
)
}
框架支持自定义主题:
import {setTheme} from "@xie-work/react-ui";
import {useEffect} from "react";
const App = () => {
useEffect(() => {
setTheme({primary: 'red'})
}, [])
return (
<div>
<Button>这是一个按钮 < /Button>
< /div>
)
}
框架支持创建组件模板
import {matrix, Button} from "@xie-work/react-ui";
const TopButton = matrix(Button, {size: 'large'})
const App = () => {
return (
<div>
<TopButton>这是一个模板按钮 < /TopButton>
< TopButton > 这是一个模板按钮 < /TopButton>
< TopButton > 这是一个模板按钮 < /TopButton>
< /div>
)
}