vue eventbus 报错 Cannot read property ‘apply‘ of undefined【解决办法】

今天爱分享给大家带来vue 使用eventbus 报错:Cannot read property ‘apply‘ of undefined【解决办法】,希望能够帮助到大家。

vue 使用eventbus 报错:Cannot read property ‘apply’ of undefined
什么是apply
引用官方的解释和js apply 通过 apply() 方法,您能够编写用于不同对象的方法。

var person = {
    fullName: function() {
        return this.firstName + " " + this.lastName;
    }
}
var person1 = {
    firstName: "Bill",
    lastName: "Gates",
}
person.fullName.apply(person1);  // 将返回 "Bill Gates"

问题原因
初步分析,是eventbus为undefined了。能引起此种情况最常见的俩种错误:1.作用域错误,this指向其他地方等等 2.代码错误。初始化失 败。第一种情况在使用evenbug场景中发送几率不大,好,重点检查第二种情况。

解决方法:检查的你的$emit和$on
最简单的方法就是看你的编辑器,如果编写正确一般会提示当前参数含义:如下

原文链接:https://blog.itblood.com/875.html,转载请注明出处。
0
祭祀之洞~巫女喂食者与色情迷宫1.0[PC+安卓/388M] [日系RPG/AI汉化]
祭祀之洞~巫女喂食者与色情迷宫1.0[PC+安卓/388M] [日系RPG/AI汉化]
3分钟前 有人购买 去瞅瞅看

站点公告

显示验证码
没有账号?注册  忘记密码?