You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vue.prototype.$emit=function(event: string): Component{constvm: Component=thisif(process.env.NODE_ENV!=='production'){constlowerCaseEvent=event.toLowerCase()if(lowerCaseEvent!==event&&vm._events[lowerCaseEvent]){tip(`Event "${lowerCaseEvent}" is emitted in component `+`${formatComponentName(vm)} but the handler is registered for "${event}". `+`Note that HTML attributes are case-insensitive and you cannot use `+`v-on to listen to camelCase events when using in-DOM templates. `+`You should probably use "${hyphenate(event)}" instead of "${event}".`)}}letcbs=vm._events[event]if(cbs){/*将类数组的对象转换成数组*/cbs=cbs.length>1 ? toArray(cbs) : cbsconstargs=toArray(arguments,1)/*遍历执行*/for(leti=0,l=cbs.length;i<l;i++){cbs[i].apply(vm,args)}}returnvm}
$emit的时候,为什么要将类数组换成数组?哪里有类数组?什么情况下会是类数组?我看就是$on的时候Vue自己建的数组啊
The text was updated successfully, but these errors were encountered: