-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit dfb9e16
Showing
11 changed files
with
616 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
|
||
# OSX | ||
# | ||
.DS_Store | ||
|
||
# node.js | ||
# | ||
node_modules/ | ||
npm-debug.log | ||
yarn-error.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# Taro RichText | ||
支持将简单的html富文本渲染为Taro组件,支持小程序、H5、ReactNative | ||
|
||
## 安装 | ||
|
||
```bash | ||
yarn add taro-react-native | ||
``` | ||
|
||
## 使用 | ||
|
||
```jsx | ||
<RichText html='<p>文本内容</p>' /> | ||
``` | ||
|
||
## 属性 | ||
|
||
| 属性 | 类型 | 说明 | | ||
| ---- | ---- | ---- | | ||
| html | string | 用于渲染的HTML | | ||
| style | CSSProperties | 用于组件最外层的样式 | | ||
|
||
## 说明 | ||
- 支持小程序、H5、ReactNative | ||
- 只支持在Taro3上使用 | ||
- 支持在小程序上渲染视频 | ||
- 此组件的目的是渲染后台编辑器生成的内容,复杂或者ReactNative不支持的样式将不会被渲染 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
.html-h1 { | ||
font-weight: bold; | ||
font-size: 64px; | ||
margin: 21.44px 0; | ||
} | ||
|
||
.html-h2 { | ||
font-weight: bold; | ||
font-size: 48px; | ||
margin: 24px 0; | ||
} | ||
|
||
.html-h3 { | ||
font-weight: bold; | ||
font-size: 37.44px; | ||
margin: 26.56px 0; | ||
} | ||
|
||
.html-h4 { | ||
font-weight: bold; | ||
margin: 35.84px 0; | ||
} | ||
|
||
.html-h5 { | ||
font-weight: bold; | ||
font-size: 26.56px; | ||
margin: 48px 0; | ||
} | ||
|
||
.html-h6 { | ||
font-weight: bold; | ||
font-size: 24px; | ||
margin: 53.44px 0; | ||
} | ||
|
||
.html-ul { | ||
margin: 35.84px 0; | ||
} | ||
.html-p { | ||
margin: 35.84px 0; | ||
flex-direction: row; | ||
flex-wrap: wrap; | ||
} | ||
.html-b { | ||
font-weight: bold; | ||
} | ||
.html-em { | ||
font-style: italic; | ||
} | ||
.html-strong { | ||
font-weight: bold; | ||
} | ||
|
||
.html-img { | ||
width: 750px; | ||
} | ||
.html-video { | ||
width: 750px; | ||
height: 422px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { CSSProperties } from 'react' | ||
import { Component } from 'react' | ||
|
||
type props = Partial<{ | ||
/** html文本 */ | ||
html: string, | ||
/** | ||
* 组件样式 应用在最外层 | ||
*/ | ||
style?: CSSProperties, | ||
}> | ||
|
||
/** | ||
* 用于渲染富文本内容 对于复杂的富文本内容可能无法正常渲染 支持ReactNative | ||
* @example | ||
* <RichText html='<p>文本内容</p>' /> | ||
*/ | ||
export class HtmlView extends Component<props>{ | ||
|
||
} |
Oops, something went wrong.