摘要: 尽可能少的抛出接口 支持多种数据源,但要谨慎不可过量,否则会使组件内部代码逻辑变得相当复杂 将可预见的组件能力抽象为API 组件的子视图设计:支持插槽的组件 组件方法与事件的区别:方法是指组件提供的能力,事件是用来更改组件属性 组件好不好用的关键:api,事件,扩展 组件化是以功能为导向,模块化是以 阅读全文
posted @ 2021-01-12 14:11 shellon 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 主版本号,向下不兼容api更改 次版本号,向下兼容功能新增 修订版本号,向下兼容问题修正 先行版本号,当要发行大版本或核心功能时,但不能保证这个版本完全正常,就要先发一个先行版本。常见的先行版本号有: alpha - 不稳定版本 beta - 基本稳定 rc - 和正式版基本相同 阅读全文
posted @ 2021-01-06 17:09 shellon 阅读(59) 评论(0) 推荐(0) 编辑
摘要: 如果使用create-react-app和require导入图像,require返回一个ES模块而不是字符串。这是因为在file-loader中,esModule选项是默认启用的。 用以下方式之一导入图像: const image = require('../path/to/image.jpg'). 阅读全文
posted @ 2021-01-06 13:46 shellon 阅读(2307) 评论(0) 推荐(0) 编辑
摘要: 前期准备 1. 初始化项目 npx create-react-app react-components --template typescript 2. 安装依赖 使用哪种打包方案:webpack/rollup **webpack** * 代码分割:可以将打包后的代码分割成多个*.chunk.js, 阅读全文
posted @ 2020-12-28 09:38 shellon 阅读(826) 评论(0) 推荐(0) 编辑
摘要: 打包过程 连接服务器 ssh root@xx.xx.xx.xx(服务器IP) 定位到当前项目目录 cd /path/projectName 更新代码到服务器 git pull 执行打包命令(这里我创建了一个脚本文件build.sh,直接运行脚本文件) sh build.sh 脚本文件build.sh 阅读全文
posted @ 2020-09-21 14:49 shellon 阅读(1579) 评论(0) 推荐(0) 编辑
摘要: 需求 react 自定义一个组件,组件内部样式可以灵活配置 问题 一般样式都可以通过属性传入,比如:颜色,字号等,但是对于一些有hover效果的地方,属性传入后,按照平时css的使用方式不太容易实现 解决办法 用js的方法,在body里创建一个style标签,将hover样式写入 注意,每次创建完成 阅读全文
posted @ 2020-09-10 09:07 shellon 阅读(7084) 评论(0) 推荐(0) 编辑
摘要: css代码 .company { width: 245px; margin-bottom: 0; text-overflow: -o-ellipsis-lastline; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; 阅读全文
posted @ 2020-09-04 09:06 shellon 阅读(383) 评论(0) 推荐(0) 编辑
摘要: 引入样式文件 import styles from './footer.module.css'; 注意: 样式文件名必须要以.module.css结尾 单类名设置 <div className={styles.channelLink}>联系我们</div> 多类名设置 方法一 <div classN 阅读全文
posted @ 2020-08-31 10:47 shellon 阅读(2251) 评论(0) 推荐(0) 编辑
摘要: validateBankCard = /^([1-9]{1})(\d{14}|\d{18})$/; 阅读全文
posted @ 2020-08-25 08:24 shellon 阅读(21483) 评论(0) 推荐(0) 编辑
摘要: validateID = /^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(1[0-2]))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/; 阅读全文
posted @ 2020-08-24 15:14 shellon 阅读(3425) 评论(0) 推荐(0) 编辑