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

component 中没有写 methods = {} 的话,从其他 component 里无法使用 $invoke 方法 #59

Closed
chaiyixiao opened this issue Mar 6, 2017 · 2 comments

Comments

@chaiyixiao
Copy link

例如 comA 有方法 methodA(不放在 methods = {} 里,而放在 onLoad() 同级时)而 comA 的 methods 为空,此时若从 comB 调用 this.$invoke('comA', 'methodA'),会报 undefined 错误。

@Gcaufy
Copy link
Collaborator

Gcaufy commented Mar 6, 2017

@chaiyixiao 我刚在new 出来的demo测试了一下, index.wpy中:

this.$invoke('counter1', 'log', 1, 2, 3);

然后在counter.wpy中加入自定义方法:

onLoad () {
}
log () {
    console.log(arguments);
}

结果打印正确

[1, 2, 3]

@chaiyixiao
Copy link
Author

1.4.5 (waiting)

F 修复了组件未定义methods时,使用$invoke报错的BUG。
working on 使用空template报错的BUG。

刚看到CHANGELOG,是以上已知 bug。

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

2 participants