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

[Taro v3.0.0-rc.2]虚拟列表组件Vue调用报错 #6467

Closed
ZHocean123 opened this issue May 26, 2020 · 2 comments
Closed

[Taro v3.0.0-rc.2]虚拟列表组件Vue调用报错 #6467

ZHocean123 opened this issue May 26, 2020 · 2 comments
Assignees

Comments

@ZHocean123
Copy link

ZHocean123 commented May 26, 2020

问题描述

使用Vue方式引入虚拟列表组件时,报错

复现步骤

  1. 按照开发文档步骤创建项目
  2. 运行微信小程序调试
  3. 看到以下报错信息
    image
VM1812:1 [Vue warn]: Error in updated hook: "TypeError: Cannot read property '$emit' of undefined"

found in

---> <VirtualList>
VM1812:1 TypeError: Cannot read property '$emit' of undefined
    at VueComponent.<anonymous> (index.js:131)
    at VueComponent.memoized (memoize.js:30)
    at VueComponent._callPropsCallbacks (index.js:157)
    at VueComponent.updated (index.js:384)
    at invokeWithErrorHandling (vue.runtime.esm.js:1854)
    at callHook (vue.runtime.esm.js:4219)
    at callUpdatedHooks (vue.runtime.esm.js:4351)
    at flushSchedulerQueue (vue.runtime.esm.js:4336)
    at Array.<anonymous> (vue.runtime.esm.js:1980)
    at flushCallbacks (vue.runtime.esm.js:1906)

滚动行为正常

期望行为

虚拟列表可正常使用

报错信息

错误定位到虚拟列表组件中

_callOnScroll: memoizeOne(
        (
          scrollDirection,
          scrollOffset,
          scrollUpdateWasRequested
        ) =>
          this.$emit('scroll', {    <=======此处的【this】值为undefined
            scrollDirection,
            scrollOffset,
            scrollUpdateWasRequested
          })
      ),
@ZHocean123 ZHocean123 changed the title Taro v3.0.0-rc.0虚拟列表组件Vue调用报错 [Taro v3.0.0-rc.0]虚拟列表组件Vue调用报错 May 26, 2020
@yuche
Copy link
Contributor

yuche commented May 26, 2020

代码麻烦贴一下

@ZHocean123
Copy link
Author

代码麻烦贴一下

新建了一个repo

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