Skip to content

global namespaced component name cause a warn. 全局含命名空间的组件名会报警告。 #7212

@LongTengDao

Description

@LongTengDao

Version 版本

2.5.9

Reproduction link 重现链接

https://jsfiddle.net/50wL7mdz/82050/#unnecessary-sample-but-required#不必要的必填示例

Steps to reproduce 重现步骤

Vue.component('my:component',{ template:'<br />' });

What is expected? 期望的结果是什么?

Don't cause a warn.
不要触发警告。

What is actually happening? 实际的结果是什么?


[Vue warn]: Invalid component name: "my:component". Component names can only contain alphanumeric characters and the hyphen, and must start with a letter.

warn @ vue:580

Vue.extend @ vue:4675

Vue.(anonymous function) @ vue:4772

install @ 0:896

Vue.use @ vue:4631


In component context, it will not cause a warn:
在局部组件中,这不会引发警告:

new Vue({

    template:'<my:component />',

    components:{

        'my:component':{ template:'<br />' }

    }

});

And, in global context, the namespaced component is usable, although it cause a warn.
另外,在全局组件中,虽然会引发警告,但组件依然可以正常使用。

So I think, this might be a problem from carelessness while engine upgrading, not intentional.
所以我想,这应该是一个引擎升级的疏忽,而非有意为止。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions