加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

React01补充

发布时间:2020-12-15 20:25:49 所属栏目:百科 来源:网络整理
导读:使用yarn安装脚手架 npm i -g yarnnpm uninstall -g create-react-appyarn global add create-react-appcreate-react-app my-app 有道翻译Api: key 应用ID 36408f4c57bebc38应用密钥 VIB9yiN5LQZZVkaXOpnKD7DpYMw9VeNl style样式 直接写在style属性中 button
  • 使用yarn安装脚手架
npm i -g yarn
npm uninstall -g create-react-app
yarn global add create-react-app
create-react-app my-app
  • 有道翻译Api: key
应用ID 36408f4c57bebc38
应用密钥 VIB9yiN5LQZZVkaXOpnKD7DpYMw9VeNl

style样式

  1. 直接写在style属性中

    <button style={{width: 200,height: 200}}>我是按钮</button>
  2. 通关变量声明样式并引用

    const btnStyle = { width: 200,height: 200 };
    ...
    <button style={btnStyle} onClick={this.handleClick}>我是按钮</button>
  3. 通过css样式文件设置

    1. 创建css文件
.btn {
    width: 300px;
    height: 200px;
    background-color: coral;
}

? 2. 引入

import ‘./css/counter.css‘;

? 3. 使用className

<button className="btn">我是按钮</button>

?

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读