react-semantic搭建后台管理系统,一

先准备工具:

  yarn安装:

    npm install -g yarn #yarn也是包管理工具,只不过它构建效率更高

    官方使用教程:https://yarnpkg.com/lang/zh-hans/docs/cli/

安装Semantic组件库,react-semantic官方地址:https://react.semantic-ui.com/collections/message:

yarn add semantic-ui-react

yarn add semantic-ui-css

create-react-app semantic-demo

yarn start #初始demo,如果该组件库不满足需求可以安装antd组件库

使用semantic组件库:

在使用之前我们先检查下项目中node_module模块是否有semantic-ui-react和semantic-ui-css组件

在index.js中引入组件:

import { Button,Form,Checkbox,Menu,Segment} from 'semantic-ui-react'

之后再相应的css文件中引入组件的css样式文件:

import 'semantic-ui-css/semantic.min.css';

如果需要引入外部的css:

require('./menuCus.css') #在相应的标签中就能调用