@ccreator/smart-ui
v1.0.3
Published
科创前端React组件库
Downloads
4
Readme
在线文档
使用说明
安装组件
npm i @ccreator/smart-ui
使用示例
import '@ccreator/smart-ui/dist/style.css';
import React from 'react';
import { Form, FormItem, Input } from '@ccreator/smart-ui';
const App = () => {
return (
<Form>
<FormItem label="测试">
<Input />
</FormItem>
</Form>
);
};
export default App;
最小化引入:手动引入最小化模块
import Form from '@ccreator/smart-ui/dist/Form';
import FormItem from '@ccreator/smart-ui/dist/FormItem';
... ...
最小化引入:vite工程优化
// vite.config.js
// 针对全模块导入的优化
// import { Form, FormItem } from '@ccreator/smart-ui';
... ...
import replace from '@rollup/plugin-replace';
import vitePluginImportus from 'vite-plugin-importus';
export default defineConfig({
plugins: [
react(),
replace({
preventAssignment: true,
'process.env.NODE_ENV': JSON.stringify(NODE_ENV),
'process.env.REACT_SPINKIT_NO_STYLES': JSON.stringify(''),
}),
vitePluginImportus([
{
libraryName: 'lodash',
camel2DashComponentName: false,
customName: (name) => `lodash/${name}`,
},
{
libraryName: '@ccreator/smart-ui',
camel2DashComponentName: false,
customName: (name) => `@ccreator/smart-ui/dist/${name}`,
},
]),
],
... ...
});