react_app 项目开发 (4)_ React UI 组件库 ant-design 的基本使用
最流行的开源 React UI 组件库
- material-ui 国外流行(安卓手机的界面效果)文档
- ant-design 国内流行 (蚂蚁金服 设计,一套 PC、一套移动端的____下拉菜单、分页......)
create-react-app myApp
yarn add antd // 安装到生产依赖
在 index.js 中 import "antd/dist/antd.min.css" 会打包全部文件
import React, { Component } from 'react'; import {Link, Route} from "react-router-dom"; import MessageDetail from "./MessageDetail/MessageDetail"; import {Button, message} from "antd"; /* 1. 引入 */
import "antd/dist/antd.min.css" /* 2. 引入样式 */ import "./css/Messages.css"; export default class Messages extends Component {
constructor(props){
super(props);
this.state = {
messages:[]
};
this.pushLink = this.pushLink.bind(this)
this.replaceLink = this.replaceLink.bind(this)
} pushLink(messageId){
this.props.history.push("/home/messages/"+messageId);
} replaceLink(messageId){
this.props.history.replace("/home/messages/"+messageId);
} componentDidMount(){
window.setTimeout(()=>{
this.setState({
messages:[
{id:1, title:"Time is running!"},
{id:3, title:"You should working hard !"},
{id:5, title:"Because the life is hard !"}
]
});
}, 400);
} render() {
const {messages} = this.state;
return (
<div className="messages clearfix">
<ul>
{
messages.map((message)=>{
return (
<li key={message.id}>
<Link to={`/home/messages/`+message.id}>
{message.title}
</Link>
<div>
<button onClick={()=>this.pushLink(message.id)}>Push 查看</button>
<button onClick={()=>this.replaceLink(message.id)}>Replace 查看</button>
</div>
</li>
)
})
}
</ul>
{/* 3. 使用 - 标签使用 */}
<Button type="primary" onClick={()=>message.info("antd 按钮 message.info")}>
HelloWorld
</Button> <button onClick={()=>this.props.history.goBack()}>
回退react_app 项目开发 (4)_ React UI 组件库 ant-design 的基本使用的更多相关文章
- react_app 项目开发 (5)_前后端分离_后台管理系统_开始
项目描述 技术选型 react API 接口 接口文档,url,请求方式,参数类型, 根据文档描述的方法,进行 postman 测试,看是否能够得到理想的结果 collections - 创建文件取项 ...
- 从零开始封装React UI 组件库并发布到NPM
github 开源地址:zswui github 说明文档:wiki 1.新建目录wui (1)进入到 wui 目录 执行 npm init 命令初始化项目.更具提示信息填充将会生成的 package ...
- React UI 组件库uiw v1.2.8 发布
uiw 高品质的UI工具包,基于React 16+的组件库.
- 十九、React UI框架Antd(Ant Design)的使用——及react Antd的使用 button组件 Icon组件 Layout组件 DatePicker日期组件
一.Antd(Ant Design)的使用:引入全部Css样式 1.1 antd官网: https://ant.design/docs/react/introduce-cn 1.2 React中使用A ...
- React组件库Ant Design的安装与使用
一.什么是 Ant Design 1.Ant Design 提炼自企业级中后台产品的交互语言和视觉风格 2.Ant Design 使用 TypeScript 构建,提供完整的类型定义文件 二.Ant ...
- react_app 项目开发 (3)_单页面设计_react-router4
(web) 利用 react-router4 实现 单页面 开发 SPA 应用 ---- (Single Page Web Application) 整个应用只有 一个完整的页面 单击链接不会刷新页面 ...
- react_app 项目开发 (7)_难点集合
/src/App/Admin/Header 布局 import {Row, Col} from "antd" <div className="header_box& ...
- react_app 项目开发 (8)_角色管理_用户管理----权限管理 ---- shouldComponentUpdate
角色管理 性能优化(前端面试) 需求:只要执行 setState(), 就会调用 render 重新渲染.由于有时调用了 setState,但是并没有发生状态的改变,以致于不必要的刷新 解决: 重写 ...
- react_app 项目开发 (6)_后台服务器端-node
后台服务器端 负责处理前台应用提交的请求,并向前台返回 json 数据 前台应用 负责 展现数据与用户交互 发 ajax 请求与后台应用交互 yarn add axios /src/api/ajax. ...
随机推荐
- Client-Side Template Injection with AngularJS
<html> <head> <meta charset="utf-8"> <script src="https://cdn.bo ...
- Java虚拟机垃圾回收(三) 7种垃圾收集器
Java虚拟机垃圾回收(三) 7种垃圾收集器 主要特点 应用场景 设置参数 基本运行原理 在<Java虚拟机垃圾回收(一) 基础>中了解到如何判断对象是存活还是已经死亡?在<Java ...
- 第五节:SignalR大杂烩(与MVC融合、全局的几个配置、跨域的应用、C/S程序充当Client和Server)
一. 说在前面的话 本节主要在前面章节的基础上补充了几个简单的知识点,比如:第三方调用通过 GlobalHost.ConnectionManager.GetHubContext<MySpecHu ...
- 069、Calico的默认连通性(2019-04-12 周五)
参考https://www.cnblogs.com/CloudMan6/p/7536746.html Calico 跨主机连通性测试 root@host1:~# docker exec bbo ...
- MongoDB and GUI 管理界面
MongoDB https://www.mongodb.com/ MongoDB AtlasDatabase as a Service The best way to deploy, operate, ...
- MATLAB更换编辑器配色方案
MATLAB的默认编辑配色方案白色,长时间面对高亮度的白色界面容易产生眼睛疲劳的感觉,那么如何更换编辑器配色方案呢?经过不断探索以及查阅资料,发现了下列几种配色方案.配色文件来源于https://gi ...
- LaTeX技巧892: Ubuntu 安装新版本TeXLive并更新
原文地址:http://www.latexstudio.net/archives/9788.html 摘要: 本文比较系统地介绍了在Ubuntu下的TeXLive的安装与配置测试过程,建议使用Ubun ...
- Visual Studio 2015 NuGet Update-Package 失败/报错:Update-Package : Unable to load the service index for source https://api.nuget.org/v3/index.json.
起因 为了用VS2015 community中的NuGet获取Quartz,在[工具]-[NuGet包管理器]-[程序包管理器控制台]中执行 Install-Package Quartz. 却报如下错 ...
- python基础之常用关键字总结
前言 到python3.6为止,python内置的关键字有33个,比python2.7的版本多了2个.下面总结一下python3的关键字的使用. python内置关键字 解释器在加载上下文的时候,如果 ...
- eclipse 报错问题:java.lang.ClassNotFoundException:
解决方法:https://www.cnblogs.com/whatlonelytear/articles/5921978.html
- react_app 项目开发 (5)_前后端分离_后台管理系统_开始