react-random-font-size
文本中的随机字符串放大的组件,适用于React
预览/Preview
快速开始/How To Start
npm install react-random-font-size --save-dev
or
yarn add react-random-font-size --save-dev
test.js
import React, {Component} from 'react'import ReactRandomFontSize from 'react-random-font-size' class Test extends Component { constructor() { super(); this.state = { font: '组件需要传入参数!', style: { "font-size": "20px" } }; } render() { return ( <ReactRandomFontSize data={this.state.font} fontStyle={this.state.style} /> ); }} export default Text
接口/Interface
属性/Props
属性名/Name | 描述/Description | 类型/Type | 默认值/Default Value |
---|---|---|---|
data | 节点树的数据 | String | 组件需要传入参数! |
fontStyle | 被放大字体的样式(将会被插入到其元素的style属性中) | Object | {"font-size": "20px"} |
proportion | 随机放大的字符数量占字符总数的比例 | Number | 0.3 |
enlarge | 不随机放大字符;指定放大某些字符; | String | -- |
许可证/License