Skip to content

Commit 7a65aa5

Browse files
authored
Update README.md
1 parent ac8c5f0 commit 7a65aa5

File tree

1 file changed

+10
-15
lines changed

1 file changed

+10
-15
lines changed

README.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -12,25 +12,27 @@ import { parse } from '@tarojs/parse-css-to-stylesheet'
1212
// Harmony
1313
const { code } = parse(jsxCode, [cssCode1, cssCode2, ...], {
1414
platformString: 'Harmony',
15-
isEnableNesting: true // 支持解析嵌套选择器,默认关闭
1615
})
1716
// code: jsx代码 string
1817
```
1918

2019
## 参数说明
2120

2221
```typescript
22+
export interface OutputOptions {
23+
isBin?: boolean
24+
}
2325
export interface ParseOptions {
24-
platformString: string; // 平台:'Harmony'
25-
isEnableNesting?: boolean; // 是否支持嵌套解析
26+
platformString: string // 平台 Harmony
27+
output?: OutputOptions
2628
}
2729
export interface ParseResult {
28-
code: string; // 输出的jsxcode
30+
code?: string
31+
buffer?: Buffer
2932
}
3033

3134
// 样式解析
3235
export function parse(
33-
component: string,
3436
styles: Array<string>,
3537
options: ParseOptions
3638
): ParseResult;
@@ -41,21 +43,14 @@ export function parse(
4143
| 配置参数 | 类型 | 可选值 | 说明 |
4244
| --------------- | ------- | ------------------------ | ---------------- |
4345
| platformString | String | 'Harmony'、'ReactNative' | 平台 |
44-
| isEnableNesting | Boolean | | 样式嵌套解析开关 |
46+
| output | Object | { isBin: false } | 输出格式 |
4547

4648
#### ParseResult
4749

4850
| 配置参数 | 类型 | 说明 |
4951
| -------- | ------ | ------------------------- |
50-
| code | String | 经过样式解析后的 JSX 代码 |
51-
52-
在 Harmony 中,编译结果会依赖`@tarojs/plugin-platform-harmony-ets`中提供的几个包方法:
53-
54-
1. `convertNumber2VP` 用于运行时进行单位转换
55-
2. `calcStaticStyle` 用于合成类,匹配类名
56-
3. `__combine_nesting_style__` 嵌套样式的合成
57-
58-
具体位于 [Taro 主仓](https://github.com/NervJS/taro) 路径:_/taro/packages/taro-platform-harmony/src/runtime-ets_
52+
| code | String | 经过样式解析后的样式代码 |
53+
| buffer | Buffer | 经过样式解析后的二进制 |
5954

6055
## 样式支持情况
6156

0 commit comments

Comments
 (0)