React-使用styled-components
1.安装
npm install --save styled-components
2.简单使用
style.js:
import styled from 'styled-components';
import { injectGlobal } from 'styled-components'
export const NavSearch = styled.input.attrs({
placeholder: '搜索'
})`
width: 160px;
height: 38px;
&::placeholder {
color: #999;
}
`;
//全局样式
injectGlobal `
body {
margin: 0;
padding: 0;
font-family: sans-serif;
}
`
组件里:
<StyledView>
<StyledText> Hello Marno! </StyledText>
</StyledView>
React-使用styled-components的更多相关文章
- styled components草根中文版文档
1.styled components官网网址 https://www.styled-components.com/docs 以组件的形式来写样式. 1.1安装 yarn add styled-c ...
- 【转】Facebook React 和 Web Components(Polymer)对比优势和劣势
原文转自:http://segmentfault.com/blog/nightire/1190000000753400 译者前言 这是一篇来自 StackOverflow 的问答,提问的人认为 Rea ...
- Facebook React 和 Web Components(Polymer)对比优势和劣势
目录结构 译者前言 Native vs. Compiled 原生语言对决预编译语言 Internal vs. External DSLs 内部与外部 DSLs 的对决 Types of DSLs - ...
- [React Fundamentals] Composable Components
To make more composable React components, you can define common APIs for similar component types. im ...
- [React] Higher Order Components (replaces Mixins)
Higher order components will allow you to apply behaviors to multiple React components. So the idea ...
- [React] React Router: Named Components
In this lesson we'll learn how to render multiple component children from a single route. Define a n ...
- [React] 09 - Tutorial: components
jsx变为js的过程:http://babeljs.io/repl/ youtube: https://www.youtube.com/channel/UCA-Jkgr40A9kl5vsIqg-BIg ...
- [React] Write Compound Components
Compound component gives more rendering control to the user. The functionality of the component stay ...
- [React] Break up components into smaller pieces using Functional Components
We are going to ensure our app is structured in a clear way using functional components. Then, we ar ...
- [React Native] Reusable components with required propType
In this React Native lesson, we will be creating a reusable Badge component. The component will also ...
随机推荐
- Flutter 布局(十)- ListBody、ListView、CustomMultiChildLayout详解
本文主要介绍Flutter布局中的ListBody.ListView.CustomMultiChildLayout控件,详细介绍了其布局行为以及使用场景,并对源码进行了分析. 1. ListBody ...
- 安卓界面之Toolbar上手
一.在配置文件采用自定义Style方法去除Actionbar <resources> <style name="MyTheme" parent="The ...
- linux网络 skb_buff
sbk_buff中的data_len指的是尾部带的page数据的长度,len指的是总共的data的长度,len-data_len是第一个线性buf的数据长度. sk_buff->len:表示当前 ...
- (网页)20个JS 小技巧超级实用
转自CSDN: 1. 将彻底屏蔽鼠标右键 oncontextmenu=”window.event.returnValue=false”< table border oncontextmenu=r ...
- Java:构造代码块,静态代码块
本文内容: 局部代码块 构造代码块 静态代码块 补充 首发日期:2018-03-28 局部代码块: 局部代码块用于限制变量的生命周期,如果希望某些变量在某一过程之后直接失效而不希望被后面继续操作时,可 ...
- 11.1、socket连接中的粘包、精确传输问题
粘包: 发生原因: 当调用send的时候,数据并不是即时发给客户端的.而是放到了系统的socket发送缓冲区里,等缓冲区满了.或者数据等待超时了,数据才会发送,所以有时候发送太快的话,前一份数据还没有 ...
- VMware-workstation12.5.6 新建虚拟机 安装 centos6.5
1.到官方下载镜像文件 注意:看到上面那两个红框不要着急复制链接用迅雷下载,因为点击进去是个页面,不知道官方做这个用意是怎样的,个人感觉很傻缺我们只要点击第一个红框就行 *************** ...
- Appium初识
一. Appium工作原理 基本工作流程如下: Appium提供了一套web服务,Appium起一个Server(4723端口),用于与脚本client通信. server接收web driver(即 ...
- centos7下rsync+crontab定期同步备份
最近需求想定期备份内部重要的服务器数据到存储里面,顺便做个笔记 以前整过一个win下的cwrsync(客户端)+rsync(服务端:存储)的bat脚本 这次整一个Linux下的脚本sh,执行定期自动备 ...
- python 在windows下的 虚拟环境
解决 python 环境问题 windows 下安装 pip install virtualenv virtualenv的基本使用 1.1 创建虚拟环境 virtualenv venv 为环境指定Py ...