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

fix: #83 修改behavior注入位置 #84

Open
wants to merge 2 commits into
base: master
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
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,21 @@ ComponentWithComputed({

(类似地,也有 `BehaviorWithComputed` 构造器对应于 `Bahavior` 。)

**注意:当使用 `ComponentWithComputed` 或者 `BehaviorWithComputed` 的时候,要留意 `computedBehavior` 的加入时机**

`computedBehavior` 会通过 `unshift` 方法加入到 `behaviors` 的开始位置,如果需要在加入 `computedBehavior` 之前加入其他的 behavior,需要通过 `behaviorsBeforeComputed` 属性加入,如:

```ts
import { ComponentWithComputed } from 'miniprogram-computed'

ComponentWithComputed({
behaviors: ['b'],
behaviorsBeforeComputed: ['a'],
})
```

最终会将behaviors处理成:`['a', 'computedBehavior', 'c']`

**关于 TS 兼容问题**

若在小程序中用 `TypeScript` 进行开发并使用到了 `Component` 构造器。这时定义 `computed` 或 `watch` 字段会出现类型报错。
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading