Skip to content

APP中视频点击播放时,控制台报错[Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'name' of undefined" #617

@woxiaoyao81

Description

@woxiaoyao81

使用环境

APP中点击视频播放时,在控制吧报错[Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'name' of undefined"

问题描述

[Vue warn]: Error in v-on handler: "TypeError: Cannot read property 'name' of undefined"
found in
<Node> at uni_modules/mp-html/components/mp-html/node/node.vue:1... (1 recursive calls)
    <MpHtml> at uni_modules/mp-html/components/mp-html/mp-html.vue:1

复现方式

APP端mp-html加载带有视频的html字符串,然后点击视频播放,在控制台将报这个错误

解决问题

通过调试发现,play中代码是

 const i = e.currentTarget.dataset.i;
 const node = this.childs[i];

在APP端e.currentTarget.dataset.i是undefined,所以读取不了视频信息,建议可修改成 const i = e.currentTarget.dataset.i||0;,然后就可以正常获取视频信息了

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions