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

4.0.4版本报错,Behaviors should be constructed with Behavior() #60

Closed
Typeve opened this issue Jun 15, 2021 · 5 comments
Closed

4.0.4版本报错,Behaviors should be constructed with Behavior() #60

Typeve opened this issue Jun 15, 2021 · 5 comments

Comments

@Typeve
Copy link

Typeve commented Jun 15, 2021

demo的版本是2.1.1是正常的
现在的版本4.0.4,编译页面会报错Behaviors should be constructed with Behavior()

@cnxfire
Copy link

cnxfire commented Jun 17, 2021

我也碰到这个问题了

@cnxfire
Copy link

cnxfire commented Jun 17, 2021

const computedBehavior = require('miniprogram-computed').behavior
这么写 问题解决

@Typeve
Copy link
Author

Typeve commented Jun 30, 2021

const computedBehavior = require('miniprogram-computed').behavior
这么写 问题解决

这不是示例写法吗?我直接复制的示例报错

@LastLeaf
Copy link
Member

LastLeaf commented Jul 6, 2021

const computedBehavior = require('miniprogram-computed').behavior
这么写 问题解决

在 >=4.0.0 时用这个写法。较低版本的话去掉末尾的 .behavior

这个是因为 4.0.0 改了接口。

@LastLeaf
Copy link
Member

LastLeaf commented Jul 6, 2021

在文档里强调了这个问题。

@LastLeaf LastLeaf closed this as completed Jul 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants