Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Xiaoming branch #2

Open
wants to merge 3 commits into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions Packages/API_DOC/index.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
# API详解
# API 详解

## normalizeVNode
child == null 或者child是布尔值,创建并返回Comment类型VNode。

child为数组类型,创建并返回Fragment类型VNnode,child作为子VNode
child == null 或者 child 是布尔值,创建并返回 Comment 类型 VNode

child为其他类型,创建并返回Text类型VNode,child作为子VNode。
child 为数组类型,创建并返回 Fragment 类型 VNnode,child 作为子 VNode。

child 为其他类型,创建并返回 Text 类型 VNode,child 作为子 VNode。。。

#### 语法

```typescript
export function normalizeVNode(child: VNodeChild): VNode {
if (child == null || typeof child === 'boolean') {
// empty placeholder
return createVNode(Comment)
} else if (isArray(child)) { // [h('div, 'one'), two] 数组就是fragment了 normalizeVnode 来进行vnode的转换 其实也就是 type 为 fragment child 为那个数组罢了
} else if (isArray(child)) {
// [h('div, 'one'), two] 数组就是fragment了 normalizeVnode 来进行vnode的转换 其实也就是 type 为 fragment child 为那个数组罢了
// fragment
return createVNode(Fragment, null, child)
} else if (typeof child === 'object') {
Expand All @@ -28,17 +31,19 @@ export function normalizeVNode(child: VNodeChild): VNode {
```

#### 参数(选填)

child,VNodeChild

#### 返回值
VNode类型


VNode 类型

## getFallthroughAttrs
遍历attrs,返回,过滤掉键不为'class'或者'style'或者正则匹配为on开头的键值对,并返回。

遍历 attrs,返回,过滤掉键不为'class'或者'style'或者正则匹配为 on 开头的键值对,并返回。

#### 代码

```typescript
type Data = { [key: string]: unknown }

Expand All @@ -54,13 +59,12 @@ const getFallthroughAttrs = (attrs: Data): Data | undefined => {
```

#### 返回值
undefined | Data


undefined | Data

## defineComponent

在创建组件的时候,使用该方法可以使用typescript的类型检测,参数补充。
在创建组件的时候,使用该方法可以使用 typescript 的类型检测,参数补充。

#### 代码

Expand Down Expand Up @@ -117,8 +121,8 @@ interface LegacyOptions<

#### 参数

options,Funtion类型或者LegacyOptions类型
options,Funtion 类型或者 LegacyOptions 类型

#### 返回值

LegacyOptions | { setup: Function }
LegacyOptions | { setup: Function }
240 changes: 0 additions & 240 deletions book/gitbook/gitbook-plugin-fontsettings/fontsettings.js

This file was deleted.