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 "pages/index" does not have a method "_proxy" to handle event "change" #2553

Closed
superlbr opened this issue Mar 29, 2020 · 15 comments
Closed

Comments

@superlbr
Copy link
Contributor

Description

[Description of the issue]
triggerEvent not work after this upgrade

Environment

  • @wepy/core: 2.0.0-alpha.16

Reproduce

[How to reproduce the issue]

  1. use wepy-vant
  2. just test van-picker, change event not trigger
    Component "pages/index" does not have a method "_proxy" to handle event "change

More relavant error

Component "pages/index" does not have a method "_initComponent" to handle event "_init".
Component "pages/index" does not have a method "_proxy" to handle event "tap".

@fudiwei
Copy link
Contributor

fudiwei commented Mar 30, 2020

降级回 @wepy/core: 2.0.0-alpha.14 吧,15/16 两个版本好多 Bug(还是算 breaking changes?总之是原来能运行的代码跑不通了)。

@superlbr
Copy link
Contributor Author

15版本啥bug,没注意 @fudiwei

@fudiwei
Copy link
Contributor

fudiwei commented Mar 30, 2020

@superlbr

15 是组件中 $emit 事件传值方式发生 breaking changes(官方也没个说明,这还是我打断点发现的)。

14 以前的传参方式是:

// 组件中事件参数
this.$emit('event', argument);

// 页面中接收事件参数
onMyEvent(e) {
  console.log(e); // 直接取就是
}

从 15 开始就变成了:

// 组件中事件参数
this.$emit('event', argument);

// 页面中接收事件参数
onMyEvent(e) {
  console.log(e.$wx.detail.arguments[0]); // 变成这样了
}

16 是页面里调用不了组件的方法了,如果在 page 中打印一下 this.$refs,会发现里面啥都没有了。


还有没有其他 Bug 我也还在测。

@superlbr
Copy link
Contributor Author

@fudiwei 15没留意,上线一周了

@fudiwei
Copy link
Contributor

fudiwei commented Mar 30, 2020

@superlbr 原生事件没变化,就自定义事件变了。

有个 PR 跟此相关,#2538 ,但这种 breaking changes 就有点儿……

@Gcaufy
Copy link
Collaborator

Gcaufy commented Mar 30, 2020

@superlbr

要同时升级 cli 和 core.

并非是 bug, 只是你升级了 core 却没有升级 cli.

后面会加入一种机制去限制 core 和 cli 的版本吧。

@superlbr
Copy link
Contributor Author

superlbr commented Mar 30, 2020

@Gcaufy 并未见"@wepy/cli": "^2.0.0-alpha.27",忘了发布吧 19781f7
限制是第二步,控制台至少给个提示吧

@fudiwei
Copy link
Contributor

fudiwei commented Mar 31, 2020

@Gcaufy cli 版本已经是 alpha.25 了(npm 中能看到的最新版本),一样有此问题;core 降级至 alpha.14 就没问题了。

@superlbr
Copy link
Contributor Author

@fudiwei 根据 19781f7 手动更新cli就行

@superlbr
Copy link
Contributor Author

superlbr commented Apr 4, 2020

close by cb6ea82 . "@wepy/cli": "^2.0.0-alpha.27" released

@superlbr superlbr closed this as completed Apr 4, 2020
@superlbr
Copy link
Contributor Author

@fudiwei
是不是组件获取参数的方式不一样?刚看到组件自定义事件

<my-comp @custom-event="handlerWithArg('myarg', arguments)"></my-comp>
...
methods: {
  handlerWithArgs(p1, p2) {
      console.log(p1, p2); // "myarg", [1, 2, 3]
  }
}

@Gcaufy
Copy link
Collaborator

Gcaufy commented Apr 23, 2020

参数以最新的文档为准

@Domines
Copy link

Domines commented Apr 28, 2020

刚开始用就遇到这个问题了, 我要不要换成mpvue???

@superlbr
Copy link
Contributor Author

mpvue的性能不是很好,wepy2有点高冷就是了@Domines

@Gcaufy
Copy link
Collaborator

Gcaufy commented May 1, 2020

@superlbr

要同时升级 cli 和 core.

并非是 bug, 只是你升级了 core 却没有升级 cli.

后面会加入一种机制去限制 core 和 cli 的版本吧。

@Domines 这里讲得很清楚了, 请同时升级 cli 和 core. 都升级至 next 版本

halfcrazy added a commit to halfcrazy/wepy-docs that referenced this issue May 5, 2020
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

4 participants