如果不切换到开发环境,没有警告,难以发现,从事开发最好还是在开发环境
如果在$emit()
中传入类似aBob这种驼峰命名法的函数名,函数将无法正常启动,并且在开发环境中给予如下提示:
[Vue tip]: Event “cschool” is emitted in component but the handler is registered for “cSchool”. 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 “c-school” instead of “cSchool”.
给出的建议是遵照DOM,将驼峰命名法更改为以连字符-
互相连接的小写字母串。